I want to have some layout a bit like this
[text tabel][edittext]
i cant find an attribute like html esque label. It seems to be the case that i need to use
[TextView][EditText]
but i cant get them to go on the same line this is my xml file.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/boat_1"/>
<EditText
android:id="@+id/entry"
android:hint="@string/IRC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/boat_2"/>
<EditText
android:id="@+id/entry"
android:hint="@string/IRC"
android:minWidth="100dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"/>
<Button android:id="@+id/close"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/title_close" />
You have basically two options:
Option 1: Use nested LinearLayouts:
Notice that I’m using
android:orientation="horizontal"for those nested layouts.Option 2: you can use another content manager, like
RelativeLayout.The advantage of this, is that you can avoid nesting, thus your layout will be easier to read/maintain/inflate. This is a brief example: