开发者

place textView and editText on the same line in android app

开发者 https://www.devze.com 2023-02-27 03:49 出处:网络
i want to place a TextView and EditText on the same line in the following main.xml. How do i do that?

i want to place a TextView and EditText on the same line in the following main.xml. How do i do that?

<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/txtTotalAmt" android:id="@+id/txtTotalAmt" ></TextView>
<EditText android:layout_width="wrap_content" android:la开发者_C百科yout_height="wrap_content" android:id="@+id/TotalAmt" android:maxLength="6" android:text="0.00" android:inputType="number|numberDecimal"></EditText>

Any help is appreciated.


i believe a surrounding linearLayout with orientation=horizontal is what your after. you could also try using a Tablelayout + Tablerow

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent" 
            android:layout_height="56px" 
            android:orientation="horizontal">
            <TextView android:layout_height="wrap_content" 
                android:layout_width="wrap_content" 
                android:text="@string/txtTotalAmt" 
                android:id="@+id/txtTotalAmt" >
            </TextView>
            <EditText android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:id="@+id/TotalAmt" 
                android:maxLength="6" 
                android:text="0.00" 
                android:inputType="number|numberDecimal">
            </EditText>
        </LinearLayout>

Hope that helps

0

精彩评论

暂无评论...
验证码 换一张
取 消