Android中 include標籤的使用

來源:互聯網
上載者:User

標籤:android   style   http   io   ar   使用   sp   on   檔案   

<?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>

 

app_title        app_tradelogin             app_bottom 三個都分別代表一個布局檔案

 

Android中 include標籤的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.