搜索图标-镜头- 3状态



我需要标准Android搜索按钮的图标-镜头-有3个状态正常,聚焦,按下。谁能提供给我这个有3个状态的图标?

认为,

在Android中可以自动设置。效仿这个例子。你可以用任何图像文件替换"state_orange":

您的控件:

android:background="@color/back_color_selector_blue_gradient"

back_color_selector_blue_gradient.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/state_orange" />
    <item android:state_selected="true" android:drawable="@drawable/state_orange" /> <!-- focused -->
    <item android:drawable="@drawable/background07" /> <!-- default -->
</selector>

background07.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item>
        <shape android:shape="rectangle">
            <gradient android:startColor="@color/grayBlue3"
                android:endColor="@color/lightBlue" android:angle="270"
                android:centerColor="@color/lightBlue" />
            <!-- border width and color -->
            <stroke android:width="1dp" android:color="#FFDDDDDD" />
            <padding android:left="1dp" android:top="1dp" android:right="1dp"
                android:bottom="1dp" />
        </shape>
    </item>
</layer-list>

state_orange.xml:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/orange" />
</shape>

相关内容

  • 没有找到相关文章

最新更新