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

Android Style.xml的應(yīng)用詳解及代碼實(shí)現(xiàn)

 更新時(shí)間:2016年10月26日 10:17:15   投稿:lqh  
這篇文章主要介紹了Android Style.xml的應(yīng)用詳解及代碼實(shí)現(xiàn)的相關(guān)資料,需要的朋友可以參考下

Style.xml的妙用

Style.xml之于Android猶如css之于Jsp

妙用

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="match_parent" 
  android:layout_height="match_parent" 
  android:orientation="vertical" > 

  <TextView 
    android:id="@+id/sensor" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

</LinearLayout> 

這樣的布局文件是很正常的。但是不如這樣好

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  style="@style/all_match" 
  android:orientation="vertical" > 

  <TextView 
    android:id="@+id/sensor" 
    style="@style/all_fill" /> 

</LinearLayout> 

省時(shí)省力,一眼還能看出是什么布局方式。只需要在Style.xml 中添加 這些代碼即可

<style name="all_fill" > 
    <item name="android:layout_width">fill_parent</item> 
    <item name="android:layout_height">fill_parent</item> 
  </style> 
  <style name="all_match" > 
    <item name="android:layout_width">match_content</item> 
    <item name="android:layout_height">match_content</item> 
  </style> 
  <style name="width_fill" > 
    <item name="android:layout_width">fill_parent</item> 
    <item name="android:layout_height">match_content</item> 
  </style> 
  <style name="height_fill" > 
    <item name="android:layout_width">match_content</item> 
    <item name="android:layout_height">fill_parent</item> 
  </style> 

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論

开鲁县| 神农架林区| 镇雄县| 宝丰县| 托里县| 康保县| 太仓市| 新竹市| 孙吴县| 扎鲁特旗| 衡阳市| 原平市| 托克逊县| 墨脱县| 棋牌| 穆棱市| 德州市| 渝北区| 新营市| 孟连| 温州市| 闽侯县| 宁乡县| 龙口市| 阿拉善右旗| 宜丰县| 吉林市| 红桥区| 和政县| 象山县| 玛曲县| 绥棱县| 兴安县| 衡阳县| 古蔺县| 江孜县| 尤溪县| 鹤山市| 静宁县| 闸北区| 永福县|