Android layout_width和layout_weight组合之后呈现的视图

来源:互联网 发布:淘宝的直通车怎么开 编辑:程序博客网 时间:2024/05/16 05:17

Android layout_width和layout_weight组合之后呈现的视图

Case Summary


   注:如下Case Detail截图都是ADT预览效果,非真实手机或模拟器运行效果。如有错误,请各位读者斧正。

Case Detail

Case01:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="2"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#0000FF"        android:text="@string/text2" /></LinearLayout>


Case02:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="2"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#0000FF"        android:text="@string/text2" /></LinearLayout>

Case03:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="2"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#0000FF"        android:text="@string/text2" /></LinearLayout>

Case04:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="2"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

   

Case01                                                                                   Case02

   

Case03                                                                                   Case04


Case05:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="0dip"        android:layout_height="match_parent"        android:layout_weight="2"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case06:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="0dip"        android:layout_height="match_parent"        android:layout_weight="2"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case07:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="2"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="0dip"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case08:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="2"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="0dip"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

   

Case05                                                                                  Case06

   

Case07                                                                                   Case08


Case09:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="2000"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case10:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="2000"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case11:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="2000"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case12:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="2000"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

   

Case09                                                                                   Case10

   

Case11                                                                                   Case12


Case13:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="0dip"        android:layout_height="match_parent"        android:layout_weight="2000"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case14:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="0dip"        android:layout_height="match_parent"        android:layout_weight="2000"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case15:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_weight="2000"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="0dip"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

Case16:

<?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="horizontal" >    <TextView        android:id="@+id/text1"        android:layout_width="wrap_content"        android:layout_height="match_parent"        android:layout_weight="2000"        android:background="#FFFF00"        android:text="@string/text1" />    <TextView        android:id="@+id/text2"        android:layout_width="0dip"        android:layout_height="match_parent"        android:layout_weight="1"        android:background="#00FFFF"        android:text="@string/text2" /></LinearLayout>

   

Case13                                                                                   Case14

   

Case15                                                                                   Case16


 

0 0
原创粉丝点击