【发布时间】:2014-09-19 12:38:04
【问题描述】:
我正在编写一个 XML 选择器
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/image_state2" android:state_pressed="true"/>
<item android:drawable="@drawable/image_state1"/>
</selector>
我只希望 state1 是透明的。所以图像被视为 - 是
状态1
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="#00000000"
android:startColor="#00000000" />
现在我想让 state2 稍微遮蔽一下我已经完成的图片。我的问题是,除了阴影渐变之外,我还希望在中心出现一个图标。我不知道如何通过xml添加这个
状态2
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="#80000000"
android:startColor="#80000000" />
【问题讨论】:
标签: android xml android-layout android-ui