I want to produce an Android screen layout that looks something like the following:
Label Text Field
Label Text Field
Label Text Field
-----Button-------
-----TextField----
That is, I want to have a TableLayout at the top, with a number of items underneath the table layout (mainly so I can force these items to be at the bottom of the screen). I have tried to nest them as in the code below, but the items at the bottom don't seem to appear.
Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:stretchColumns="1"
android:shrinkColumns="1" android:layout_height="wrap_content" android:layout_gravity="center_vertical">
<TableRow>
<TextView android:text="Latitude:"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<TextView android:id="@+id/latitude"
android:text="Not available"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</TableRow>
<TableRow>
<TextView android:text="Longitude:"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView android:id="@+id/longitude"
android:text="Not available"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</TableRow>
<TableRow>
<TextView android:text="Altitude:"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView android:id="@+id/altitude"
android:text="Not available"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</TableRow>
<TableRow>
<TextView android:text="Accuracy:"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView android:id="@+id/accuracy"
android:text="Not available"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</TableRow>
</TableLayout>
<Button android:id="@+id/save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Save"/>
<TextView android:text="Test"/>
</LinearLayout>
in your table layout add these
android:layout_height="80dp"
android:layout_weight="1.0"
also for the bottom button and and text view add fixed height.If your table needs more space then put it between scrollView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With