本篇文章主要介绍了"LinearLayout布局中Layout_weight的深刻理解-为何需设置android:layout_width="0dp"",主要涉及到方面的内容,对于Javajrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播感兴趣的同学可以参考一下:
原文:http://blog.csdn.net/chy800/article/details/46397927Android:LinearLayout布局中La...
原文:http://blog.csdn.net/chy800/article/details/46397927
Android:LinearLayout布局中Layout_weight的深刻理解
首先看一下LinearLayout布局中Layout_weight属性的作用:它是用来分配属于空间的一个属性,你可以设置他的权重。很多人不知道剩余空间是个什么概念,下面我先来说说剩余空间。
看下面代码:
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"><EditText
android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="left" android:text="one"/><EditText
android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1.0" android:text="two"/><EditText
android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" android:text="three"/>LinearLayout>
运行结果是: