<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- pressed -->
<item android:state_pressed="true" >
<shape android:shape="rectangle">
<gradient
android:startColor="#ff8c00"
android:endColor="#ff8c00"
android:angle="270" />
<corners
android:radius="4dp" />
</shape>
</item>
<!-- focus -->
<item android:state_focused="true" >
<shape>
<gradient
android:startColor="#ffc2b7"
android:endColor="#ffc2b7"
android:angle="270" />
<corners
android:radius="4dp" />
</shape>
</item>
</selector>
然后在button的定义中加上:android:background="@drawable/button_selector_gradient"
(button_selector_gradient是上述xml文件的文件名称)
Android button设置height后圆角消失问题
最新推荐文章于 2024-05-28 16:47:58 发布