place textView and editText on the same line in android app
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
精彩评论