你想使用
Android的Shape Drawables.
http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
绘制/ cool_button_background.xml
android:shape="rectangle">
android:radius="@dimen/corner_radius" />
android:angle="270"
android:startColor="@color/almost_white"
android:endColor="@color/somewhat_gray"
android:type="linear" />
绘制/ cool_button.xml
android:drawable="@drawable/cool_inner_press_bottom" />
android:state_window_focused="true"
android:drawable="@drawable/cool_inner_focus_bottom" />
android:drawable="@drawable/cool_button_background" />
奖金:您可能想要为该按钮创建一个样式,以便您可以在整个程序中保持一致.你可以剪出这个步骤,只需设置按钮的android:background =“@ drawable / cool_button”.
价值观/ styles.xml
@drawable/cool_button_background
最后,按钮!
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/appwidget_bg">
android:id="@+id/btnAction"
android:layout_width="wrap_content"
android:layout_weight="wrap_content"
style="@style/CoolButton"
/>