layout资源包含,android开发必读 Android开发技术

  有时候我们在一个Android程序中可能会复用布局文件,这时可以在一个xml文件中复用过去的布局文件,但是和常规的使用不同的是,需要加上类似包含头文件一样的include关键字,比如下面我们需要包含layout文件夹下的view.xml布局文件,需要<include layout="@layout/view" />  这样下,完整的如下,大家可以试一试。

<?xml version="1.0" encoding="utf-8"?>  
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    >  
<TextView    
    android:layout_width="wrap_content"   
    android:layout_height="wrap_content"   
    android:text="@string/cwj" 
    />
 
<include layout="@layout/view" /> 
<include android:id="@+id/block" layout="@layout/item" />  

<TextView    
    android:layout_width="wrap_content"   
    android:layout_height="wrap_content"   
    android:text="@string/android123" 
    />  
</LinearLayout> 

本人擅长Ai、Fw、Fl、Br、Ae、Pr、Id、Ps等软件的安装与卸载,精通CSS、JavaScript、PHP、ASP、C、C++、C#、Java、Ruby、Perl、Lisp、Python、Objective-C、ActionScript、Pascal等单词的拼写,熟悉Windows、Linux、OS X、Android、iOS、WP8等系统的开关机。

通过下面的方式来联系我们:

电邮:138762189@qq.com

联系QQ:点击这里给我发消息

官方站:www.tadke.com

※ ※ 联系请加我的企鹅号 ※※

※ ※技术支持请微信联系站长 ※※

Copyright © 2023 Tadke.com. 琼ICP备20000547号