上面布局中放了10個CheckBox,然后設(shè)置了CheckBox的背景圖片位,背景選擇器,同時設(shè)置了字體的顏色選擇器。
帶邊框下劃線背景選擇器代碼:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 選中狀態(tài) --> <item android:state_checked="true"> <!-- 設(shè)置層次背景 --> <layer-list> <!-- 底層 --> <item> <shape android:shape="rectangle"><!-- 畫矩形 --> <!--邊框色--> <stroke android:width="1dp" android:color="@color/gray27"/> <!-- 背景色 --> <solid android:color="@color/gray17"/> <!-- 圓角 --> <corners android:radius="3dp"/> </shape> </item> <!-- 上層 --> <item android:top="36.5dp"> <!-- top:距離頂部多少db開始畫線,需配合View的高度繪制 --> <shape android:shape="rectangle"> <solid android:color="@color/mainColor"/> </shape> </item> </layer-list> </item> <!-- 默認(rèn)狀態(tài) --> <item> <shape> <stroke android:width="1dp" android:color="@color/gray27"/> <solid android:color="@color/white"/> <corners android:radius="@dimen/radius"/> </shape> </item> </selector>
分享名稱:AndroidView背景選擇器編寫技巧-創(chuàng)新互聯(lián)
瀏覽路徑:http://muchs.cn/article20/dsgeco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)、手機網(wǎng)站建設(shè)、品牌網(wǎng)站建設(shè)、網(wǎng)站收錄、網(wǎng)頁設(shè)計公司、電子商務(wù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容