1 답변
-
이런식으로 되는것을 원하신다면
drawable에서 xml을 mybutton.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" > <shape android:shape="rectangle" > <corners android:radius="3dip" /> <stroke android:width="1dip" android:color="#5e7974" /> <gradient android:angle="-90" android:startColor="#345953" android:endColor="#689a92" /> </shape> </item> <item android:state_focused="true"> <shape android:shape="rectangle" > <corners android:radius="3dip" /> <stroke android:width="1dip" android:color="#5e7974" /> <solid android:color="#58857e"/> </shape> </item> <item > <shape android:shape="rectangle" > <corners android:radius="3dip" /> <stroke android:width="1dip" android:color="#5e7974" /> <gradient android:angle="-90" android:startColor="#8dbab3" android:endColor="#58857e" /> </shape> </item> </selector>
이런 식으로 정의해주시고 버튼의 background를
<Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" android:textColor="#ffffff" android:background="@drawable/mybutton" android:text="Buttons" />
지정해주시면 됩니다.
댓글 입력