StateListDrawable和ShapeDrawable结合使用
生活随笔
收集整理的這篇文章主要介紹了
StateListDrawable和ShapeDrawable结合使用
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
有時(shí)候,我們既需要定義StateListDrawable,又需要定義ShapeDrawable。比如說(shuō)我們點(diǎn)擊一個(gè)按鈕讓其背景隨之改變,同時(shí)我們對(duì)按鈕本身也做一些設(shè)置,比如圓角。此時(shí)我們?cè)趯tateListDrawable里添加ShapeDrawable即可。
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:drawable="@drawable/pressed" android:state_pressed="true"></item><item android:drawable="@drawable/unpressed" android:state_pressed="false"></item> </selector>
轉(zhuǎn)載于:https://www.cnblogs.com/eleph-ant/archive/2012/09/04/2670713.html
總結(jié)
以上是生活随笔為你收集整理的StateListDrawable和ShapeDrawable结合使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Android获取存储卡路径的方式(转)
- 下一篇: 拾遗:『ext4 Quota』