android中多个LinearLayout平分布局
来源:互联网 发布:海淘网转运 知乎 编辑:程序博客网 时间:2024/04/29 18:27
要想均分布局,必须是在LinearLayout布局下才可完成,其他文章中都是在LinearLayout中均分控件,现在是将LinearLayout中嵌套多个LinearLayout,均分LinearLayout,这样你就可以在LinearLayout任意添加控件了
程序如下:
<?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:layout_gravity="center"
android:orientation="horizontal" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#ff00f0" >
</LinearLayout>
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#ff00f0" >
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#f0f00f" >
</LinearLayout>
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#f0f00f" >
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#0000ff" >
</LinearLayout>
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#0000ff" >
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#ff0f00" >
</LinearLayout>
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#ff0f00" >
</LinearLayout>
</LinearLayout>
结果如下:
1 0
- android中多个LinearLayout平分布局
- android linearlayout 平分一行
- LinearLayout 实现左中右 平分屏幕宽度布局
- Android 水平平分布局和垂直平分布局
- 【Android控件布局】Layout 水平平分空间、垂直平分空间
- 【Android控件布局】Layout 水平平分空间、垂直平分空间
- 【Android控件布局】Layout 水平平分空间、垂直平分空间
- Android 布局 LinearLayout
- android布局之LinearLayout
- android之布局LinearLayout
- Android 布局 之 LinearLayout
- android 之LinearLayout布局
- android LinearLayout布局
- Android开发--布局LinearLayOut
- Android 线性布局:LinearLayout
- android linearlayout 布局
- Android的LinearLayout布局
- Android之LinearLayout布局
- TextView字体大小设置同方式的区别
- 欢迎使用CSDN-markdown编辑器
- Leetcode023--计数和说出来
- TextView不依附ScrollView滚动
- error/utility.c/SystemCommand/2094.
- android中多个LinearLayout平分布局
- 3维迷宫的bfs
- vmstat详解
- android_58_service_remote_AIDL调用远程服务
- NPM常用命令
- LINUX命令总结
- 【前端学习连载日志】BOM顺利学完了
- android 4.4 以太网网络共享功能研究和实现
- c# 关于网站读取excel文档