android:layout_weight属性的简单使用

效果:

style.xml

<style name="etStyle2">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:background">@drawable/corner_edit</item>
    </style>

activity_test.xml

        <LinearLayout 
                android:layout_marginTop="5dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="center_vertical">
                <TextView 
                    android:layout_width="98dp"
                    android:layout_height="wrap_content"
                    android:text="税款所属期"/>
                <EditText 
                    style="@style/etStyle2"
                    android:layout_weight="0.5"/>
                <TextView 
                    style="@style/tvStyle"
                    android:text="至"/>
                <EditText 
                    style="@style/etStyle2"
                    android:layout_weight="0.5"/>
            </LinearLayout>

 

 

posted @ 2013-11-06 16:37  yshy  阅读(379)  评论(0编辑  收藏  举报