最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時間:2016年01月18日 11:32:30   作者:nosxcy  
這篇文章主要介紹了Android布局之LinearLayout自定義高亮背景的方法,實例分析了Android中LinearLayout布局參數(shù)設置技巧,需要的朋友可以參考下

本文實例講述了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>

其次在對應的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>

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

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

相關文章

最新評論

将乐县| 富民县| 广汉市| 财经| 清水河县| 信丰县| 赣州市| 芜湖市| 当涂县| 屯留县| 托克逊县| 宝兴县| 卫辉市| 龙江县| 吉木萨尔县| 双峰县| 鞍山市| 兰州市| 万安县| 长子县| 岑巩县| 南京市| 商洛市| 分宜县| 兰州市| 徐汇区| 防城港市| 金坛市| 大足县| 澜沧| 阳山县| 友谊县| 马山县| 定日县| 盐山县| 安义县| 遂溪县| 合水县| 平湖市| 巩义市| 新宁县|