欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

background

程序员文章站 2022-03-19 16:20:39
按钮 背景
按钮 背景
<?xml version="1.0" encoding="utf-8"?>
<selector
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/control3_1" android:state_enabled="true" android:state_focused="true" android:state_pressed="false"/>
    <item android:drawable="@drawable/control3_1" android:state_enabled="true" android:state_pressed="true"/>
    <item android:drawable="@drawable/control3_1" android:state_checked="true" android:state_enabled="true"/>
    <item android:drawable="@drawable/control3_0"/>
</selector>

check_box 背景
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/check_true1" android:state_checked="true"></item>
<item android:drawable="@drawable/check_true1" android:state_selected="true"></item>
<item android:drawable="@drawable/check_false1"></item>
</selector>

 

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:state_pressed="true" android:drawable="@mipmap/link_check" />
    <item android:state_checked="false" android:state_pressed="true" android:drawable="@mipmap/link_uncheck" />
    <item android:state_checked="false" android:drawable="@mipmap/link_uncheck" />
    <item android:state_checked="true" android:drawable="@mipmap/link_check" />
</selector>

 

单背景色
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#3B87F6"/>
    <corners android:radius="6dp"
        />
</shape>

圆 背景色

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"
    android:useLevel="false">

    <solid android:color="@color/background9"/>
    <stroke
        android:width="1dp"
        android:color="@color/background9" />
    <size
        android:width="48dp"
        android:height="48dp" />
</shape>

背景渐变色

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="12dp"
        />
    <gradient
        android:angle="0"
        android:startColor="#3F9BF0"
        android:endColor="#1C71E6"
   />
</shape>

 

图片旋转

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <rotate
            android:drawable="@drawable/loading_icon"
            android:fromDegrees="0.0"
            android:pivotX="50.0%"
            android:pivotY="50.0%"
            android:toDegrees="360.0"/>
    </item>
</layer-list>

 

单线条边框背景
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="10dp"/>
    <stroke
        android:width="1dp"
        android:color="@color/textcolor59"
        />
</shape>

本文地址:https://blog.csdn.net/qingchunqidewo/article/details/110518849