国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Android > 正文

Android布局之LinearLayout自定義高亮背景的方法

2020-04-11 10:57:00
字體:
供稿:網(wǎng)友

本文實例講述了Android布局之LinearLayout自定義高亮背景的方法。分享給大家供大家參考,具體如下:

首先創(chuàng)建linearlayout_background.xml文件

res/drawable/linearlayout_background.xml

<?xml version="1.0" encoding="utf-8"?><selectorxmlns:android="http://schemas.android.com/apk/res/android">  <itemandroid:state_pressed="true" android:drawable="@drawable/button_pressed"/>  <itemandroid:state_focused="true" android:drawable="@drawable/button_pressed"/>    <itemandroid:drawable="@drawable/button_normal"/></selector>

其次在對應(yīng)的xml布局文件中

<LinearLayout  android:layout_height="wrap_content"  android:layout_width="wrap_content"  android:clickable="true"<!--這條是必須的,否則沒有高亮顯示效果,這有別于自動的button,textview等其他控件-->    android:background="@drawable/linearlayout_background"> <Button ....../><TextView ...../></LinearLayout>

更多關(guān)于Android布局相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android布局layout技巧總結(jié)

希望本文所述對大家Android程序設(shè)計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 秭归县| 砀山县| 龙游县| 海口市| 精河县| 桦川县| 鲁甸县| 荆州市| 澄城县| 景东| 南阳市| 新化县| 松桃| 奎屯市| 灵川县| 汪清县| 巴马| 平顶山市| 乌拉特中旗| 万宁市| 乌海市| 新野县| 昌宁县| 栖霞市| 金沙县| 五家渠市| 巴彦淖尔市| 潞西市| 东乡族自治县| 民和| 沧州市| 井研县| 阿坝县| 双流县| 彭泽县| 台州市| 庆云县| 营山县| 原阳县| 永新县| 瑞安市|