Android Layout中使用include标签实现UI布局重用
2017-03-19 21:59
393 查看
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
Android Layout中使用include标签实现UI布局重用
1、创建一个独立的布局文件作为共享布局,common_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="这是一个共享的布局文件"
/>
</LinearLayout>
2、在主布局中使用标签进行包含
<?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" >
<include layout="@layout/common_layout"></include>
</LinearLayout>
Android Layout中使用include标签实现UI布局重用
1、创建一个独立的布局文件作为共享布局,common_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="这是一个共享的布局文件"
/>
</LinearLayout>
2、在主布局中使用标签进行包含
<?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" >
<include layout="@layout/common_layout"></include>
</LinearLayout>
相关文章推荐
- Android Layout中使用include标签实现UI布局重用
- Android优化——UI优化(二) 使用include标签复用布局
- android_应用开发之(使用<include>标签重用布局)
- Android提高显示布局文件的性能,使用include标签重用layouts
- Android Training - 提升布局文件的性能(Lesson 2 - 使用include标签重用Layout)
- Android提高显示布局文件的性能,使用include标签重用layouts
- 【Android Training - Performance】提高显示布局文件的性能[Lesson 2 - 使用include标签重用Layout]
- androidUi优化之--通过include标签来重用布局
- Android UI 优化 使用<include/>和 <merge />标签
- WebWork中UI标签的使用时的布局问题
- 在android布局中使用include和merge标签
- Android 使用<include /> 标签来重用layout代码
- XML使用include实现布局(layout)复用
- android重用layout-include标签的使用
- Android 使用<include /> 标签来重用layout代码
- 使用include实现布局(layout)复用
- Android UI设计之<六>使用HTML标签,实现在TextView中对部分文字进行加粗显示
- (转)Android中View绘制优化二一---- 使用<include />标签复用布局文件
- Android UI 优化 使用<include/>和 <merge />标签
- 在android布局中使用include和merge标签