Text in Button Changing on clicking other controls

杀马特。学长 韩版系。学妹 提交于 2020-01-17 08:10:14

问题


I have created a layout which consist of three buttons in linear layout. Whenever i click on any other controls the text in the button changes. Please see the layout given below:

<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="fill_parent" 
                                android:layout_height="wrap_content" 
                                android:background="@color/list_select">

          <Button android:layout_width="match_parent"
                  android:layout_height="wrap_content" 
                  android:id="@+id/set" 
                  android:text="@string/button_settings_done" 
                  android:layout_marginTop="@dimen/button_settings_margin_top" 
                  android:onClick="hello()" 
                  android:gravity="center" 
                  android:textColor="@color/buttonColor" 
                  android:textStyle="bold" 
                  android:typeface="serif" android:layout_gravity="center" android:layout_weight="1">                  
          </Button>
          <Button android:layout_width="match_parent" 
                  android:layout_height="wrap_content"
                  android:text="@string/button_settings_cancel"
                  android:id="@+id/cancel"
                  android:layout_marginTop="@dimen/button_settings_margin_top"
                  android:gravity="center"
                  android:textColor="@color/buttonColor"
                  android:textStyle="bold" 
                  android:typeface="serif" android:layout_gravity="center" android:layout_weight="1"></Button>
          <Button
              android:id="@+id/delete"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginTop="@dimen/button_settings_margin_top"
              android:text="@string/button_settings_delete"
              android:gravity="center"
              android:textColor="@color/buttonColor"
              android:textStyle="bold"
              android:typeface="serif"
              android:layout_gravity="center" android:layout_weight="1"/>

enter code here

来源:https://stackoverflow.com/questions/9331640/text-in-button-changing-on-clicking-other-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!