最新国产好看的视频,伊人天堂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)論

永安市| 罗平县| 秦皇岛市| 崇州市| 罗城| 绵阳市| 高邮市| 登封市| 沙湾县| 深州市| 阳原县| 大同县| 灵石县| 阜新| 策勒县| 永宁县| 玉环县| 鄂伦春自治旗| 商南县| 仁布县| 桂林市| 安国市| 延川县| 灌阳县| 文成县| 河东区| 庆安县| 安平县| 绵竹市| 衢州市| 子洲县| 石城县| 塔城市| 开封市| 福海县| 无为县| 中宁县| 文登市| 兴和县| 来宾市| 弋阳县|