当前位置: 移动技术网 > IT编程>移动开发>Android > Android开发总体布局

Android开发总体布局

2019年06月18日  | 移动技术网IT编程  | 我要评论

abramovi04,赵露内衣照,chichifa

<?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文件布局。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网