Tuesday, April 9, 2013

[android help] Nest TableLayout inside LinearLayout - is it possible?

android - Nest TableLayout inside LinearLayout - is it possible? - Stack Overflow




















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?




xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
android:layout_width="match_parent"
android:stretchColumns="1"
android:shrinkColumns="1" android:layout_height="wrap_content" android:layout_gravity="center_vertical">

android:textAppearance="?android:attr/textAppearanceLarge"
/>
android:text="Not available"
android:textAppearance="?android:attr/textAppearanceLarge"
/>


android:textAppearance="?android:attr/textAppearanceLarge"/>
android:text="Not available"
android:textAppearance="?android:attr/textAppearanceLarge"/>


android:textAppearance="?android:attr/textAppearanceLarge"/>
android:text="Not available"
android:textAppearance="?android:attr/textAppearanceLarge"/>


android:textAppearance="?android:attr/textAppearanceLarge"/>
android:text="Not available"
android:textAppearance="?android:attr/textAppearanceLarge"/>





























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























You can try to do it with Droid Draw its free and It will generate the right xml for you.






















Set the weight of the table to "1", and the height to "0dp".




android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:shrinkColumns="1"
android:stretchColumns="1" >


...



android:id="@+id/save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Save" />

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test" />























for textfield you have to use EditText in place of TextView and add android:layout_height and android:layout_width to each widget used in your application


with regards ajay




















default







.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...