Android Custom button background color, radians
As selector in drawable.
- Android:state_pressed= "true" click
- Android:state_focused= "true" focus
XML file for a custom button (Res/drawable/button_selector.xml)
<?xml version= "1.0" encoding= "Utf-8"?><selectorxmlns:android="Http://schemas.android.com/apk/res/android"> <!--pressed -- <item android:state_pressed="true" > <shapeandroid:shape="Rectangle"> <gradientandroid:startcolor= "#ff8c00"android:endcolor="#ff8c00" Android:angle="/>" <cornersAndroid:radius="4DP" /> </shape> </Item> <!--Focus -- <item android:state_focused="true" > <shape> <gradientandroid:startcolor= "#ffc2b7"android:endcolor="# Ffc2b7 "android:angle= "/> <cornersAndroid:radius="4DP" /> </shape> </Item><!--default -- <item> <shape> <gradientandroid:startcolor="#d0d0d0"android:endcolor= "#d0d0d0"android:angle="0" /> <cornersAndroid:radius="4DP" /> </shape> </Item></selector>
Reference
<relativelayout android:layout_width="Wrap_content"android:layout_height="Wrap_content"android:paddingright="10dip"android:paddingtop="3dip"> <textview android:id="@+id/time"Android:layout_width="Wrap_content"android:layout_height="Wrap_content"android:layout_alignparentleft="true"Android:textcolor="@color/light_grey"/> <button android:id="@+id/agree"Android:layout_width="Wrap_content"android:layout_height="23dip"android:layout_toleftof="@+id/publish"android:drawableleft="@drawable/agree_view"android:layout_marginright="10dip"android:gravity="Center"Android:textsize="@dimen/text_size_common"Android:textcolor="@color/light_grey"Android:background="@drawable/button_selectort"/> <button android:id="@+id/publish"Android:layout_width="Wrap_content"android:layout_height="23dip"android:layout_alignparentright="true"android:drawableleft="@drawable/reply_view"android:gravity="Center"Android:textsize="@dimen/text_size_common"Android:textcolor="@color/light_grey"Android:background="@drawable/button_selector"/></relativelayout>
Android Custom button background color, radians