亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 系統 > Android > 正文

解析android中include標簽的使用

2020-04-11 12:11:37
字體:
來源:轉載
供稿:網友
在一個項目中我們可能會需要用到相同的布局設計,如果都寫在一個xml文件中,代碼顯得很冗余,并且可讀性也很差,所以我們可以把相同布局的代碼單獨寫成一個模塊,然后用到的時候可以通過<include /> 標簽來重用layout代碼。
app_title.xml:
復制代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/titleLayout" android:layout_width="fill_parent" android:layout_height="wrap_content"
   android:background="@drawable/bt" xmlns:android="http://schemas.android.com/apk/res/android">

  <TextView android:text="@string/login" android:id="@+id/title" android:textSize="20px" android:textColor="@color/white"
   android:layout_width="wrap_content" android:layout_centerInParent="true" android:layout_height="wrap_content"/>  
  <Button android:text="返回" android:id="@+id/refresh" android:layout_width="wrap_content" android:layout_height="wrap_content"
   android:layout_alignParentRight="true" android:focusable="false" android:textColor="@color/white"
   android:background="@drawable/okbutton" android:layout_marginRight="3px"/>
</RelativeLayout>

app_tradelogin.xml:
復制代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<!-- android:layout_below與 android:layout_above 是必須設置的,否則界面不規則,不設置android:layout_above本界面沒有滑動效果-->
<ScrollView android:layout_below="@+id/titleLayout" android:layout_above="@+id/appbottom" android:layout_width="fill_parent"
  android:layout_height="fill_parent" android:layout_centerInParent="true" xmlns:android="http://schemas.android.com/apk/res/android">
 <LinearLayout android:id="@+id/theWholeLinearLayout" android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="wrap_content" android:paddingLeft="10px" android:paddingTop="6px" android:paddingRight="10px" >
  <LinearLayout android:id="@+id/linearLayoutLeft" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
   <TableLayout android:id="@+id/widget43" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android" android:stretchColumns="1">
    <TableRow >
    <!--  引用定義好的TextView樣式,如果這里的屬性和樣式里定義的屬性重復,則這里會替換樣式里定義的屬性-->
     <TextView android:id="@+id/traderName" android:text="@string/traderName" style="@style/StyleTextInfo1" mce_style="@style/StyleTextInfo1"/>
     <Spinner android:id="@+id/traderNameS" android:layout_width="fill_parent" android:layout_height="wrap_content">
     </Spinner>
    </TableRow>

    <TableRow>
     <TextView android:id="@+id/departName" android:text="@string/departName" style="@style/StyleTextInfo1" mce_style="@style/StyleTextInfo1"/>
     <Spinner android:id="@+id/departNameS" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    </TableRow>

    <TableRow >
     <TextView android:id="@+id/strComponyName" android:text="@string/accType" style="@style/StyleTextInfo1" mce_style="@style/StyleTextInfo1"/>
     <Spinner android:id="@+id/accTyte" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    </TableRow>

    <TableRow >
     <TextView android:id="@+id/strUserAcc" android:text="@string/userAcc" style="@style/StyleTextInfo1" mce_style="@style/StyleTextInfo1"/>
     <EditText android:id="@+id/accEditText" android:text="" android:numeric="decimal" style="@style/StyleEditText1" mce_style="@style/StyleEditText1"/>
    </TableRow>

    <TableRow >
     <TextView android:id="@+id/userPwd" android:text="@string/userPWD" style="@style/StyleTextInfo1" mce_style="@style/StyleTextInfo1"/>
     <EditText android:id="@+id/userPwdET" android:text="" android:password="true" style="@style/StyleEditText1" mce_style="@style/StyleEditText1"/>
    </TableRow>

    <TableRow >
     <TextView android:id="@+id/commPwd" android:text="@string/commPWD" style="@style/StyleTextInfo1" mce_style="@style/StyleTextInfo1"/>
     <EditText android:id="@+id/commPwdET" android:text="" android:password="true" style="@style/StyleEditText1" mce_style="@style/StyleEditText1"/>
    </TableRow>
   </TableLayout>
  </LinearLayout>

  <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">

    <LinearLayout android:id="@+id/linearLayoutTab1" android:layout_height="wrap_content"
     android:layout_width="fill_parent" android:orientation="horizontal">

     <LinearLayout android:id="@+id/linearLayoutTab2" android:layout_height="wrap_content"
      android:layout_width="fill_parent" android:orientation="horizontal" android:layout_weight="1">
      <CheckBox android:id="@+id/recordAcc"  android:layout_width="wrap_content" android:layout_height="wrap_content"/>
      <TextView android:id="@+id/commPwd" android:text="@string/saveUserAcc" style="@style/StyleTextInfo1" mce_style="@style/StyleTextInfo1"/>
     </LinearLayout> 
     <LinearLayout android:id="@+id/linearLayoutTab2" android:layout_height="wrap_content"
      android:layout_width="fill_parent" android:orientation="horizontal" android:layout_weight="1">

      <CheckBox android:id="@+id/hideAcc" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
      <TextView android:id="@+id/commPwd" android:text="@string/ycUserAcc" style="@style/StyleTextInfo1" mce_style="@style/StyleTextInfo1"/>
     </LinearLayout>  
    </LinearLayout>

   <LinearLayout android:id="@+id/linearLayoutTab1" android:layout_height="wrap_content"
     android:layout_width="fill_parent" android:orientation="horizontal">

     <LinearLayout android:layout_width="220px" android:layout_height="wrap_content" android:orientation="horizontal"
      android:gravity="center">

              <Button android:id="@+id/confirmexch" android:gravity="center" android:layout_width="wrap_content" 
         android:layout_height="50px" android:textSize="22dp" android:text="@string/login" android:layout_weight="1"
         android:focusable="false" android:textColor="@color/white" android:background="@drawable/buttonl"/>
     </LinearLayout>

     <LinearLayout android:id="@+id/linearLayoutTab" android:layout_height="wrap_content"
      android:layout_width="fill_parent" android:gravity="center">
      <ImageView android:layout_width="wrap_content" android:layout_height="50px" android:id="@+id/myImage"/>
     </LinearLayout>
  </LinearLayout>
 </LinearLayout>
 </LinearLayout>
</ScrollView>

app_bottom.xml:
復制代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/appbottom" android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="wrap_content" android:layout_alignParentBottom="true"
  xmlns:android="http://schemas.android.com/apk/res/android">

 <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent"
  android:layout_height="wrap_content" android:background="@drawable/light">
  <ImageView  android:id="@+id/about" android:layout_width="30px" android:layout_height="wrap_content" android:src="@drawable/ttt"
    android:layout_alignParentLeft="true"/>
  <TextView android:id="@+id/light" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="@color/black"/>
 </LinearLayout>

 <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent"
  android:layout_height="wrap_content" android:background="@drawable/mainmenu">
  <Button android:id="@+id/quotButton" android:layout_weight="1" android:layout_width="52px" android:layout_height="wrap_content"
   android:textColor="@color/white" android:text="" android:background="@drawable/button1"/>

  <Button android:id="@+id/entrustButton" android:layout_weight="1" android:layout_width="52px" android:layout_height="wrap_content"
   android:textColor="@color/white" android:text="" android:background="@drawable/button1"/>
  <Button android:id="@+id/queryButton" android:layout_weight="1" android:layout_width="52px" android:layout_height="wrap_content"
   android:textColor="@color/white" android:text="" android:background="@drawable/button1"/>

  <Button android:id="@+id/yinZhengButton" android:layout_weight="1" android:layout_width="52px" android:layout_height="wrap_content"
   android:textColor="@color/white" android:text="" android:background="@drawable/button1"/>

  <Button android:id="@+id/recordButton" android:layout_weight="1" android:layout_width="52px" android:layout_height="wrap_content"
   android:textColor="@color/white" android:text="" android:background="@drawable/button1"/>

  <Button android:id="@+id/logoutButton" android:layout_weight="1" android:layout_width="52px" android:layout_height="wrap_content"
   android:textColor="@color/white" android:text="" android:background="@drawable/button1"/>
 </LinearLayout>
</LinearLayout>

tradelogin_portrait.xml:
復制代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" style="@style/StyleLayoutMain" mce_style="@style/StyleLayoutMain"
 xmlns:android="http://schemas.android.com/apk/res/android">

 <!-- include標簽內不能設置RelativeLayout屬性,如android:layout_alignParentBottom,因為不起作用 -->
 <!-- include標簽內設置id屬性后(android:id),其引用的布局layout內的id屬性就不起作用了,懷疑是其引用的layout外層包裹了一層include標簽
  或者是覆蓋了其內的屬性id-->
 <!-- 如果沒有include標簽,所有布局代碼都寫在一個xml文件中,界面會顯得很冗余,可讀性很差。而且界面加載的時候是按照順序加載的,前面的布局不能
  調用其后面的布局id。而采用include后,一個include中可以引用其后的include中的布局id屬性 -->
 <include android:id="@id/titleLayout" layout="@layout/app_title" />
 <include layout="@layout/app_tradelogin"/>

 <include layout="@layout/app_bottom"/>

</RelativeLayout>

效果如下:

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
日本精品视频网站| 这里只有精品视频在线| 丁香五六月婷婷久久激情| 红桃视频成人在线观看| 欧美性猛交xxxx黑人| 成人在线国产精品| 中文字幕亚洲一区二区三区五十路| 成人女保姆的销魂服务| 亚洲欧美一区二区激情| 55夜色66夜色国产精品视频| 久久精品久久久久久| 日韩av理论片| www.色综合| 日韩成人在线播放| 欧美国产日本高清在线| 久久久久久18| 欧美大学生性色视频| 欧美激情喷水视频| 91色在线观看| 人人做人人澡人人爽欧美| 国产91精品久久久久久久| 亚洲人成电影网站色…| 国产精品丝袜高跟| 欧美另类老女人| 国产在线日韩在线| 欧美夫妻性生活xx| 精品一区二区亚洲| 欧美综合在线观看| 在线免费看av不卡| 欧美视频在线免费看| 欧美黄色片免费观看| 欧美电影院免费观看| 第一福利永久视频精品| 欧美在线国产精品| 国产香蕉精品视频一区二区三区| 色偷偷88888欧美精品久久久| 不卡毛片在线看| 亚洲网址你懂得| 91久久国产精品| 一区二区欧美亚洲| 日韩av资源在线播放| 欧美夫妻性生活xx| 国产精品专区一| 欧美日韩免费网站| 68精品久久久久久欧美| 国产成人精品视频| 人人爽久久涩噜噜噜网站| 欧美大肥婆大肥bbbbb| 韩国视频理论视频久久| 国产精品三级网站| 日韩一中文字幕| 伊人精品在线观看| 久久精视频免费在线久久完整在线看| 亚洲成人激情在线| 一区二区av在线| 日韩一区二区福利| 热re91久久精品国99热蜜臀| 富二代精品短视频| 中文字幕亚洲欧美在线| 亚洲天堂av图片| 国产精品2018| 蜜月aⅴ免费一区二区三区| 欧美亚洲成人xxx| 久热精品视频在线观看| 国产脚交av在线一区二区| 91av在线播放| 日韩精品在线电影| 国产精品久久久久久久久久新婚| 日韩在线播放一区| 国精产品一区一区三区有限在线| 欧美成人激情图片网| 欧美乱妇高清无乱码| 欧美大秀在线观看| 国产精品视频yy9099| 欧美精品久久久久久久免费观看| 欧美成人午夜免费视在线看片| 国产亚洲欧美视频| 亚洲欧美激情在线视频| 亚州成人av在线| 日韩va亚洲va欧洲va国产| 欧美最猛黑人xxxx黑人猛叫黄| 精品成人av一区| 欧美在线免费看| 午夜精品久久久久久久久久久久久| 中文字幕亚洲天堂| 国产999视频| 美女性感视频久久久| 国产精品久久久久久久av电影| 九九热精品视频国产| 91精品久久久久久久久中文字幕| 国产精品视频在线观看| 欧美成人亚洲成人日韩成人| 欧美成在线观看| 黄色精品在线看| 亚洲免费伊人电影在线观看av| 国产精品视频一| 欧美影院久久久| 日韩毛片在线观看| 91精品国产综合久久香蕉922| 久久理论片午夜琪琪电影网| 色中色综合影院手机版在线观看| 精品久久久视频| 狠狠躁夜夜躁人人躁婷婷91| 欧美在线免费视频| 日韩精品小视频| 日产精品久久久一区二区福利| 国产精品视频xxx| 日韩精品久久久久久福利| y97精品国产97久久久久久| 亚洲第一视频网| 在线观看日韩视频| 欧美电影免费观看网站| 成人精品一区二区三区电影黑人| 青青青国产精品一区二区| 国产精品青青在线观看爽香蕉| 国产精品你懂得| 亚洲国内高清视频| 国产精品 欧美在线| 91精品国产九九九久久久亚洲| 国产精品人人做人人爽| 日韩美女视频在线观看| 国产精品女人网站| 亚洲天堂av高清| 最新国产精品拍自在线播放| 久久久久久久久网站| 亚洲成人av在线播放| 超碰日本道色综合久久综合| 成人写真福利网| 91在线视频导航| 欧美日韩加勒比精品一区| 久久久久成人网| 国外色69视频在线观看| 欧美与欧洲交xxxx免费观看| 青青在线视频一区二区三区| 日本电影亚洲天堂| 亚洲精品电影网站| 精品亚洲va在线va天堂资源站| 伊人一区二区三区久久精品| 国产色婷婷国产综合在线理论片a| 亚洲成人黄色网| 久久久精品久久久久| 91精品国产自产在线观看永久| 亚洲经典中文字幕| 精品久久久久久久久久久久| 奇米成人av国产一区二区三区| 欧美日韩视频在线| 亚洲综合色激情五月| 庆余年2免费日韩剧观看大牛| 97涩涩爰在线观看亚洲| 国产精品吊钟奶在线| 丝袜美腿亚洲一区二区| 日韩av影片在线观看| 欧美一级视频免费在线观看| 色综合导航网站| 懂色av中文一区二区三区天美| 国产精品久久久久久久av电影| 欧美日韩性视频在线| 97国产成人精品视频| 国产精品99久久久久久久久久久久| www国产精品视频| 亚洲一区二区三区sesese| 亚洲精品成a人在线观看| 国产日韩精品在线观看| 欧美性感美女h网站在线观看免费|