设为首页 加入收藏

TOP

Android开发总体布局
2019-08-26 06:34:37 】 浏览:17
Tags:Android 开发 总体 布局
<?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" >
    <!-- head -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
        <!-- 引入布局 也是xml布局文件-->
        <include layout="@layout/head"/>
    </LinearLayout>

    <!-- 中间 -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1">
        <!-- 引入布局 也是xml布局文件-->
        <include layout="@layout/middle"/>
    </LinearLayout>

    <!-- 引入其他布局 也是xml布局文件-->
    <!--  …… -->

    <!-- 底部 -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    <!-- 引入布局 也是xml布局文件-->
       <include layout="@layout/bottom"/>
    </LinearLayout>

</LinearLayout>    

先总体布局,有的布局可以分为几部分,比如头部、中部、底部,代码如上。

用include layout=""在布局中引入其他的布局,这样结构就比较清楚,方便布局模块化,复用布局。

简单的,可以直接一个xml文件布局。

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Java list.remove( )方法需要注意.. 下一篇Protocol Buffer使用转换工具将pr..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目