其他分享
首页 > 其他分享> > Drawable渐变、圆角、按钮触碰、非button按钮添加触摸效果

Drawable渐变、圆角、按钮触碰、非button按钮添加触摸效果

作者:互联网

圆角

shape类型

 <corners
        android:radius="12dp"
        android:topLeftRadius="12pt"
        android:topRightRadius="0pt"
        android:bottomLeftRadius="12pt"
        android:bottomRightRadius="0pt"/>

渐变

shape类型

 <gradient
        android:startColor="#556063"
        android:endColor="#2F353B"
        android:angle="360"
        android:type="linear"/>

图片选择

select类型

 <item android:drawable="@drawable/main_search_press" android:state_focused="true"/>
    <item android:drawable="@drawable/main_search_press" android:state_checked="true"/>
    <item android:drawable="@drawable/main_search_press" android:state_pressed="true"/>
    <item android:drawable="@drawable/main_search_press" android:state_checkable="true"/>
    <item android:drawable="@drawable/main_search_unpress"/>

颜色选择

select类型

 <item android:color="@color/main_rb_press" android:state_focused="true"/>
    <item android:color="@color/main_rb_press" android:state_checked="true"/>
    <item android:color="@color/main_rb_press" android:state_pressed="true"/>
    <item android:color="@color/main_rb_press" android:state_checkable="true"/>
    <item android:color="@color/main_rb_unpress"/>

非button控件添加可触碰时间

android:clickable="true"

标签:触碰,圆角,button,shape,按钮,类型,Drawable,渐变,select
来源: https://blog.csdn.net/qq_39252578/article/details/97389022