2012-02-17 3 views
0

テーブルレイアウトとリストビューの3つの水平ボタンで構成される画面を作成しました。 リストビューにあるチェックボックスをクリックするたびに、ボタンにあるテキストが左にシフトします。 問題を解決してください。 画面のレイアウトコードとスクリーンショットを参照してください。リスト内のチェックボックスをオンにすると、ボタンのテキストが中央から左に移動しています

<RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:orientation="vertical"> 

     <TableLayout android:id="@+id/TableLayout01" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:layout_alignParentBottom="true"> 

      <TableRow android:id="@+id/TableRow01" 
           android:layout_width="match_parent" 
           android:layout_height="fill_parent" 
           android:background="@color/list_select" android:weightSum="3"> 

      <Button android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/set" 
        android:text="@string/button_settings_done" 
        android:layout_marginTop="@dimen/button_settings_margin_top" 
        android:textColor="@color/buttonColor" 
        android:textStyle="bold" 
        android:typeface="serif" android:layout_weight="1"> 

      </Button> 
      <Button android:layout_width="wrap_content" 
        android:layout_height="fill_parent" 
        android:text="@string/button_settings_cancel" 
        android:id="@+id/cancel" 
        android:layout_marginTop="@dimen/button_settings_margin_top" 
        android:textColor="@color/buttonColor" 
        android:textStyle="bold" 
        android:typeface="serif" android:layout_weight="1"></Button> 


      <Button 
       android:id="@+id/delete" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="@dimen/button_settings_margin_top" 
       android:text="@string/button_settings_delete" 
       android:textColor="@color/buttonColor" 
       android:textStyle="bold" 
       android:typeface="serif" android:layout_weight="1"/> 

  <ListView 
       android:id="@android:id/list" 
       android:layout_width="match_parent" 
       android:layout_height="fill_parent" 
       android:layout_above="@+id/TableLayout01" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentTop="true" android:cacheColorHint="@color/transparent" android:divider="@color/list_select" android:dividerHeight="@dimen/list_settings_divider_height"> 

      </ListView> 

スクリーンショット Before checking checkbox After checking

+1

[他のコントロールをクリックしたときに変化するボタンのテキスト](http://stackoverflow.com/questions/9331640/text-in-button-changing-on-clicking-other-controls) –

答えて

-3

その奇妙これを試してみてください... あなたをそれはcase..Iは同じ問題を抱えていた私には非常によく働い

btn1.setText("Done"); 
btn2.setText("Cancel"); 
btn3.setText("Delete"); 

again..likeこれらのボタンのテキストをmethod..setのOnClick上のリストview..thereのチェックボックスの存在をクリックされています。 これがあなたを助けてくれることを願っています

+0

標準の書かれた英語で書いてみてください。スペルや句読点は間違いありません。これはlolcatzサイトではありません。 – tchrist

+0

2つの単語...本当に!!! @チクロ – user1125690

関連する問題