android:layout_weight padding margin 的使用

来源:互联网 发布:什么是淘宝联盟 编辑:程序博客网 时间:2024/06/04 18:01

1、layout_weight 的妙用。


<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" ><ImageView             android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:src="@drawable/ic_launcher"    android:layout_weight="1"        />    <TextView        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello" /></LinearLayout>
如果去掉 
android:layout_weight="1"

在上图TextView将不可见。

       有了该属性,系统会先考虑,下面的TextView   。满足后它后,才会考虑设置了android:layout_weight

的控件。

2、padding margin


原创粉丝点击