ImageView和TextView的background点击效果

来源:互联网 发布:希捷备份软件 编辑:程序博客网 时间:2024/05/18 03:03

对于ImageView和TextView的background点击效果【仅用一个ImageView的情况】


背景引用

<ImageView        android:background="@drawable/<span style="color:#ff0000;">selector_imageview_position_manage</span>"  />

背景xml代码 selector_imageview_position_manage

<selector xmlns:android="http://schemas.android.com/apk/res/android">    <item android:drawable="@drawable/<span style="color:#3333ff;">pressed_imageview_position_manage</span>" android:state_pressed="true"/>        <item android:drawable="@drawable/<span style="color:#cc33cc;">focus_imageview_position_manage</span>" android:state_focused="true"/>     </selector>

按下的效果: pressed_imageview_position_manage

<pre name="code" class="html"><shape xmlns:android="http://schemas.android.com/apk/res/android"><solid android:color="#99FFFFFF" /><paddingandroid:bottom="3dp"android:left="3dp"android:right="3dp"android:top="3dp" /><!-- <cornersandroid:bottomLeftRadius="5dp"android:bottomRightRadius="5dp"android:topLeftRadius="5dp"android:topRightRadius="5dp" /> --></shape>


选中的效果 :focus_imageview_position_manage

<shape xmlns:android="http://schemas.android.com/apk/res/android"><solid android:color="#ff6600" /><paddingandroid:bottom="3dp"android:left="3dp"android:right="3dp"android:top="3dp" /><!-- <cornersandroid:bottomLeftRadius="5dp"android:bottomRightRadius="5dp"android:topLeftRadius="5dp"android:topRightRadius="5dp" /> --></shape>


0 0
原创粉丝点击