安卓listview长按时的由黄到透明渐变色怎么改变成由蓝到透明? 5
1个回答
2015-01-14 · 知道合伙人软件行家
关注
展开全部
给item的根布局增加一个背景选择器
selector
具体代码
将会以下文件保存到drawable目录中, 然后到item的根目录中调用android:background="@drawable/xxx"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid android:color="#9AD6F0"/>
</shape> <!-- <stroke android:width="0.1dp" android:color="#333333"/> -->
</item>
<item android:state_selected="true" >
<shape>
<solid android:color="#9AD6F0"/>
</shape>
</item>
<item android:state_focused="true" >
<shape>
<solid android:color="#9AD6F0"/>
</shape>
</item>
<item>
<shape>
<solid android:color="#00000000"/>
</shape>
</item>
</selector>
selector
具体代码
将会以下文件保存到drawable目录中, 然后到item的根目录中调用android:background="@drawable/xxx"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid android:color="#9AD6F0"/>
</shape> <!-- <stroke android:width="0.1dp" android:color="#333333"/> -->
</item>
<item android:state_selected="true" >
<shape>
<solid android:color="#9AD6F0"/>
</shape>
</item>
<item android:state_focused="true" >
<shape>
<solid android:color="#9AD6F0"/>
</shape>
</item>
<item>
<shape>
<solid android:color="#00000000"/>
</shape>
</item>
</selector>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询