如何在 LinearLayout 中并排设置 4 个编辑文本?

How to set 4 edittexts side by side to each other in LinearLayout?

如何在LinearLayout中并排设置4个edittexts,可以吗?请建议我

试试这个

     <LinearLayout
        android:layout_width="0dp"
        android:orientation="horizontal" 
        android:layout_weightSum="4" >

        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />

        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />

        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
    </LinearLayout>

LinearLayout,您应该:
-> 方向=水平
-> layout_weight=1
-> layout_height=0dp

EditText,你应该:
-> layout_weight=0.25 (4*0.25 = 1)

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:orientation="horizontal" >

    <EditText
            android:layout_width="match_parent"
            android:layout_weight="0.25"
            android:layout_height="wrap_content" />

    <EditText
            android:layout_width="match_parent"
            android:layout_weight="0.25"
            android:layout_height="wrap_content" />

    <EditText
            android:layout_width="match_parent"
            android:layout_weight="0.25"
            android:layout_height="wrap_content" />

    <EditText
            android:layout_width="match_parent"
            android:layout_weight="0.25"
            android:layout_height="wrap_content" />
</LinearLayout>