您的位置:首页 > 其它

按比例分布控件

2015-07-01 17:02 232 查看
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/container"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    tools:context="com.example.uilayouttest.MainActivity"

    tools:ignore="MergeRootFrame" >

    <EditText

        android:id="@+id/editText1"

        android:layout_width="0dp"

        android:layout_height="wrap_content"

        android:layout_weight="2"

        android:ems="10" >

        <requestFocus />

    </EditText>

    <Button

        android:id="@+id/button1"

        android:layout_width="0dp"

        android:layout_height="wrap_content"

        android:layout_weight="1"

        android:text="Button" />

</LinearLayout>

关键看宽度:0dp 必须如此  不小心包裹内容就看不出效果了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: