[英]Android shape button stripped
Use ImageButton and use above image as background of that button: 使用ImageButton并使用上面的图像作为该按钮的背景:
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/YOUR_BTN_IMG"/>
1st make a xml file in drawable folder with bg1 name and put this code 首先使用bg1名称在可绘制文件夹中创建一个xml文件并放入此代码
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:centerColor="#4CAF50"
android:endColor="#2E7D32"
android:startColor="#b5e7b7"
android:type="linear" />
</shape>
than where ever you want it use like 比你希望它使用的地方
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bg1"/>
here u change angle,start end and center color as per your requirement 在这里你可以根据你的要求改变角度,开始结束和中心颜色
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.