I’m having an issue here, I’m unfamiliar with layouts on android and I can’t get this layout to do as I wish.
I would like it to appear as follows:
[Button][Button]
Text Filled Here
Text Filled Here
Text Filled Here
Text Filled Here
Text Filled Here
The TextView is populated via my messagehelper that sends the text to the UI
Eventually my code will be iterating through a list of objects retrieved from a web service and displaying them all on their own rows, with an option to press one and view it on a map.
At the moment, I can only get either the two buttons OR the text to show separately, or all three of them on the same line, not the two buttons on the first line and the text populated downwards!!
Here is my code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/buttonLayout"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="1">
<Button
android:id="@+id/vehicleButton"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="1"
android:text="Refresh"
android:onClick="getVehicles" />
<Button
android:id="@+id/logoutButton"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="1"
android:text="Logout"
android:onClick="logout" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textLayout"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<TextView
android:id="@+id/textView1"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
By default,
LinearLayoutorientation ishorizontal, you need to change the 1st and 3rdLinearLayoutorientation on yourxmltovertical.use
android:orientation="vertical"