我想打一个自定义的按钮形状,如何做到这一点?
I want to make a custom button with shape, how to do this?
这是样品钮扣这是椭圆形状。该梯度
表示,随着角度的起始ñ结束颜色。四角为椭圆shape..Try这个..提到这一点在按钮的背景 Android的名称 XML :后台=@可绘制/样品
.Save在XML中的绘制
This is the sample button which is of oval shape.. The gradient
says the start n end color along with the angle. corners for the oval shape..Try this.. Mention the name of this xml in button background android:background="@drawable/sample"
.Save the xml in drawable.
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#302226"
android:endColor="#6D7B8D"
android:angle="45"/>
<padding android:left="6dp"
android:top="6dp"
android:right="6dp"
android:bottom="6dp" />
<corners android:radius="30dp" />
</shape>
另外,请查阅此链接的自定义按钮。