Android checkbox doesn't show - android

The application I'm developing has some check boxes. Whenever I try it on my Nexus 7 it works perfectly. However, when I try it out on a Galaxy Tab 2 7.0 the check boxes do not show up.
In Nexus 7: http://tinypic.com/view.php?pic=2wokitu&s=5
In Galaxy Tab: http://tinypic.com/view.php?pic=2z4he13&s=5
I've been trying to make sense of this, but really I can't figure out why in the world would it work on the Nexus but not on the Tab. Any insight will be greatly appreciated. And yes, unfortunately I have to use the Tab.
Edit: Sorry I posted yesterday when it was time to leave and I sort of did it in a hurry. Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#777777" >
<RelativeLayout
android:id="#+id/KernelInspectionLayout"
android:layout_width="match_parent"
android:layout_height="1186dp"
android:orientation="horizontal" >
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txtTitle"
android:layout_marginLeft="70dp"
android:layout_marginTop="50dp"
android:background="#000000" >
<TableRow
android:id="#+id/Header1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txtProblema"
android:layout_margin="2dp"
android:gravity="center"
android:background="#FFF000"
android:textColor="#000000"
android:text="Problema"
android:layout_span="2"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="30dp" />
<TextView
android:id="#+id/txtAbreviatura"
android:layout_margin="2dp"
android:gravity="center"
android:background="#FFF000"
android:textColor="#000000"
android:text="Abreviatura"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow11"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkOK"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="OK"
android:textSize="30dp" />
<TextView
android:id="#+id/txtOK"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Good Ear"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtOKA"
android:layout_margin="2dp"
android:gravity="center"
android:text="OK"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkWorms"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Gusano"
android:textSize="30dp" />
<TextView
android:id="#+id/txtWorms"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Gusano"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtGU"
android:layout_margin="2dp"
android:gravity="center"
android:text="GU"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkCSBAdult"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="CSB - Adult"
android:textSize="30dp" />
<TextView
android:id="#+id/txtCSBAdult"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="CSB-Adulto"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtCSBA"
android:layout_margin="2dp"
android:gravity="center"
android:text="CSB-A"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkCSBLarva"
android:tag="CSB - Larva"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:textSize="30dp" />
<TextView
android:id="#+id/txtCSBLarva"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="CSB-Larva"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtCSBL"
android:layout_margin="2dp"
android:gravity="center"
android:text="CSB-L"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkCSFLarva"
android:tag="CSF - Larva"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:textSize="30dp" />
<TextView
android:id="#+id/txtCSFLarva"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="CSF-Larva"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtCSFL"
android:layout_margin="2dp"
android:gravity="center"
android:text="CSF-L"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkAves"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Aves"
android:textSize="30dp" />
<TextView
android:id="#+id/txtAves"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Aves"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtAve"
android:layout_margin="2dp"
android:gravity="center"
android:text="Ave"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkThrips"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Thrips"
android:textSize="30dp" />
<TextView
android:id="#+id/txtThrips"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Thrips"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtTH"
android:layout_margin="2dp"
android:gravity="center"
android:text="TH"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkHongo"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Hongo"
android:textSize="30dp" />
<TextView
android:id="#+id/txtHongo"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Hongo"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtHG"
android:layout_margin="2dp"
android:gravity="center"
android:text="HG"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkBacteria"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Bacteria"
android:textSize="30dp" />
<TextView
android:id="#+id/txtBacteria"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Bacteria/PudriciĆ³n"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtBac"
android:layout_margin="2dp"
android:gravity="center"
android:text="Bac"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow9"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkKernelPopping"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Kernel Popping"
android:textSize="30dp" />
<TextView
android:id="#+id/txtKernelPopping"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Kernel Popping"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtKP"
android:layout_margin="2dp"
android:gravity="center"
android:text="KP"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow12"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkCommonSmut"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Common Smut"
android:textSize="30dp" />
<TextView
android:id="#+id/txtKernelPopping"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Common Smut"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtCS"
android:layout_margin="2dp"
android:gravity="center"
android:text="CS"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow13"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkMazPart"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Mazorca partida durante Huskback"
android:textSize="30dp" />
<TextView
android:id="#+id/txtMazPart"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Mazorca partida"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtMP"
android:layout_margin="2dp"
android:gravity="center"
android:text="Maz Partida"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow14"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkMazRem"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="Mazorca Removida"
android:textSize="30dp" />
<TextView
android:id="#+id/txtMazRem"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="Mazorca removida"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtMR"
android:layout_margin="2dp"
android:gravity="center"
android:text="Removida"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow15"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkNoPoll"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="No Poll"
android:textSize="30dp" />
<TextView
android:id="#+id/txtNoPoll"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="No Poll"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtNP"
android:layout_margin="2dp"
android:gravity="center"
android:text="NP"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow10"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/chkNoKernel"
android:layout_margin="2dp"
android:background="#FFFFFF"
android:tag="No Kernel"
android:onClick="KernelInspectionCheck"
android:textSize="30dp" />
<TextView
android:id="#+id/txtNoKernel"
android:layout_margin="2dp"
android:background="#color/table_bg_colors"
android:gravity="center"
android:text="No Kernel"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF0000"
android:textSize="30dp" />
<TextView
android:id="#+id/txtNK"
android:layout_margin="2dp"
android:gravity="center"
android:text="NK"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/abrv_bg_colors"
android:textSize="30dp" />
</TableRow>
</TableLayout>
<TextView
android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/btnSave"
android:layout_alignParentTop="true"
android:layout_marginTop="38dp"
android:text="Choose"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Spinner
android:id="#+id/spnNoKernel"
android:layout_width="500dp"
android:layout_height="80dp"
android:layout_below="#+id/tableLayout1"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:tag="0" />
<Button
android:id="#+id/btnSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:onClick="SaveKernelInspection"
android:text="Save" />
<TextView
android:id="#+id/txtKernelEstimate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spnNoKernel"
android:layout_below="#+id/spnNoKernel"
android:layout_marginTop="100dp"
android:text="Kernel Estimate"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/inputKernelEstimate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txtKernelEstimate"
android:layout_alignBottom="#+id/txtKernelEstimate"
android:layout_marginLeft="20dp"
android:layout_toRightOf="#+id/txtKernelEstimate"
android:ems="10"
android:inputType="number" >
</EditText>
</RelativeLayout>
</ScrollView>
Edit 2: It seems the problem has to do with the span I'm doing in the header part. I took that out and the checkbox appears but the headers are not aligned.

Please remove android:background=....... line from checkbox layout then it will work.

Related

How to implement a timetable in Android

I know this sort of question has been asked a few times now but all threads I read didn't really help me out with this specific problem, so here's the thing:
For our IT lesson at school, we have to develop our own app. Unlike my fellows, I've already had some experience with developing android apps but this problem overwhelmed me... :(
My idea was to create a student's management app to keep track of the timetable, upcoming exams and so on...
But I got stuck at the timetable beacause I don't know how to realize those "lesson placeholder thingies" (don't know how to name 'em :D).
Just look at my source code and you'll understand:
section_table.xml
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="16dp" >
<TableRow
android:id="#+id/top_row"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1" >
<TextView
android:id="#+id/spaceView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.16" />
<TextView
android:id="#+id/monday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.16"
android:text="#string/monday" />
<TextView
android:id="#+id/tuesday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.16"
android:text="#string/tuesday" />
<TextView
android:id="#+id/wednesday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.16"
android:text="#string/wednesday" />
<TextView
android:id="#+id/thursday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.16"
android:text="#string/thursday" />
<TextView
android:id="#+id/friday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.16"
android:text="#string/friday" />
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="1" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="2" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="3" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="4" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="5" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="6" />
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="7" />
</TableRow>
<TableRow
android:id="#+id/tableRow8"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="8" />
</TableRow>
<TableRow
android:id="#+id/tableRow9"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="9" />
</TableRow>
<TableRow
android:id="#+id/tableRow10"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="10" />
</TableRow>
<TableRow
android:id="#+id/tableRow11"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="11" />
</TableRow>
<TableRow
android:id="#+id/tableRow12"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="12" />
</TableRow>
<TableRow
android:id="#+id/tableRow13"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="13" />
</TableRow>
<TableRow
android:id="#+id/tableRow14"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="14" />
</TableRow>
<TableRow
android:id="#+id/tableRow15"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="15" />
</TableRow>
<TableRow
android:id="#+id/tableRow16"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#drawable/border" >
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="16" />
</TableRow>
My problem is that I don't know whether to use buttons, textviews, views, etc...
Using a button forced the other tablerows to get smaller and unreadable... :(
Please help, thank you guys very much in advance! :)

How can I fix a button at the bottom in the scrollview android?

I have this following layout.
I have a button which comes at the bottom of the screen.
I have put my table layout in the scrollview which is scrolling perfectly.
But using scrollview makes the bottom button disapper.
How can I fix it.
This is my xml layout file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="80dp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="61dp"
android:gravity="center"
android:text="Interest Rates on Domestic Term Deposits (w.e.f. 26th Septemr, 2013)"
android:textColor="#color/White" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/Red"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Pariculars"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="General"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Senior Citizens(p.a.)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7days to 14 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="15 days to 90 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="91 days to 180 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="181 days to 12 months"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
</TableLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom" >
<Button
android:id="#+id/homeInterestButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Home" />
</RelativeLayout>
I just need my tablelayout content to be scrollable and the homebutton should come at the bottom of the activity.
add android:fillViewport="true" attribute for your ScrollView. See the code below.
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dip"
android:fillViewport="true"
android:layout_weight="1" >
also change the code like below.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="80dp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="61dp"
android:gravity="center"
android:text="Interest Rates on Domestic Term Deposits (w.e.f. 26th Septemr, 2013)"
android:textColor="#color/White" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/Red"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Pariculars"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="General"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Senior Citizens(p.a.)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7days to 14 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="15 days to 90 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="91 days to 180 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="181 days to 12 months"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
</TableLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom" >
<Button
android:id="#+id/homeInterestButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Home" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
#Shink
Check this removed -- weight -- from scrollview and replaced 0dp to wrap_content, changed the parent to relative layout, and button without having its container relativelayout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/darker_gray"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="80dp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="61dp"
android:gravity="center"
android:text="Interest Rates on Domestic Term Deposits (w.e.f. 26th Septemr, 2013)"
android:textColor="#android:color/white" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/black"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Pariculars"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="General"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Senior Citizens(p.a.)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7days to 14 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="15 days to 90 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="91 days to 180 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="181 days to 12 months"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
</TableLayout>
</ScrollView>
</LinearLayout>
<Button
android:id="#+id/homeInterestButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Home" />
</RelativeLayout>
Put below 2 lines in the 2nd Top Linear layout And you are done:
android:layout_height="0dp"
android:layout_weight="1"
In short What you have to do is put the below xml in your project and run it.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#000" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="80dp"
android:layout_marginBottom="50dp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="61dp"
android:gravity="center"
android:text="Interest Rates on Domestic Term Deposits (w.e.f. 26th Septemr, 2013)"
android:textColor="#android:color/white" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#900"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Pariculars"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="General"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Senior Citizens(p.a.)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7days to 14 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="15 days to 90 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="91 days to 180 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="181 days to 12 months"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#900"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Pariculars"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="General"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Senior Citizens(p.a.)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow><TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#900"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Pariculars"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="General"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Senior Citizens(p.a.)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow><TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#900"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Pariculars"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="General"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Senior Citizens(p.a.)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</TableRow>
</TableLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<Button
android:id="#+id/homeInterestButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home" />
</RelativeLayout>
</RelativeLayout>
Hope this works for you:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="80dp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="61dp"
android:gravity="center"
android:text="Interest Rates on Domestic Term Deposits (w.e.f. 26th Septemr, 2013)"
android:textColor="#color/White" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/Red"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Pariculars"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="General"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Senior Citizens(p.a.)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Revised for deposit upto"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Rs. 15 Lacs"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7days to 14 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.25%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="15 days to 90 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="7.75%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="91 days to 180 days"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="8.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="181 days to 12 months"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="9.50%"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/White" />
</TableRow>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom" >
<Button
android:id="#+id/homeInterestButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Home" />
</RelativeLayout>
</TableLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
Well, you will need to put your button out of ScrollView. So there will be another level of nesting needed. Put your ScrollView in a RelativeLayout (or LinearLayout), put the button at the bottom. That way it wont scroll down as items are added to the ScrollView
<RelativeLayout ...>
<ScrollView android:id="#+id/scroll"...>
<!-- The child of ScrollView -->
</ScrollView>
<Button android:layout_alignParentBottom = "true"
android:layout_below="#id/scroll" />
</RelativeLayout>
Your root layout is LinearLayout. Give your button's layout 0 weight and give other layout weight 1. It should do the job.

Android's tabular arrangement issue in 4 by 4 form during runtime

For app having:
Target: API 8 or Android Froyo.
The emulator: Android GingerBread 2.0.3.
App reads the data from the file from /sdcard which is supposed to be shown in Gridview layouts. But, in runtime the arrangement is distorted in landscape and portrait layout orientations.
The layout seems perfect while design time as in Image#1, but during the run time it is as seen in the Image#2.
And here is my XML for the Layout for landscape orientation:
<LinearLayout
android:id="#+id/LinearLayoutInside"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/button2"
android:orientation="vertical"
android:background="#drawable/border_bkgrnd" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView12"
android:layout_below="#+id/TextView12"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_alignRight="#+id/textView11"
android:layout_alignTop="#+id/TextView22"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtTitlev1"
android:layout_below="#+id/txtTitlev1"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/TextView31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtTitlev3"
android:layout_alignParentRight="true"
android:layout_below="#+id/txtTitlev3"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
<TextView
android:id="#+id/TextView33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/TextView23"
android:layout_alignBottom="#+id/TextView23"
android:layout_alignLeft="#+id/TextView32"
android:layout_alignParentRight="true"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/txtTitlev1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/TextView21"
android:layout_alignParentLeft="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlLeadid"
android:textColor="#color/Turquoise4"
android:layout_weight="1"
android:textSize="20sp"
android:textStyle="bold|normal"
android:typeface="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/TextView32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView31"
android:layout_alignParentRight="true"
android:layout_below="#+id/TextView31"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView21"
android:layout_below="#+id/TextView21"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView22"
android:layout_below="#+id/TextView22"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/txtTitlev3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlContact"
android:textColor="#color/Turquoise4"
android:textSize="20sp"
android:layout_weight="1"
android:textStyle="bold|normal" />
<TextView
android:id="#+id/txtTitlev2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlName"
android:textColor="#color/Turquoise4"
android:textSize="20sp"
android:layout_weight="1"
android:textStyle="bold|normal" />
<TextView
android:id="#+id/TextView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/TextView32"
android:layout_centerHorizontal="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
android:layout_weight="1"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
[EDIT]
Is there any other alternative for arrangement?
Thanks in advance...
why dont you try using it through the RelativeLayout.layoutparams and the relative layout java coding.
you can do this using any layout for example here i am using a linear layout
Textview hname, game,time;
hname = new TextView(context);
game =new TextView(context);
time = new TextView(context);
LinearLayout ll = new LinearLayout(context);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(600, 100);
//add the settext here for ur textviews
ll.addView(hname, lp);
ll.addView(game, lp);
ll.addView(time, lp);
setcontentview(ll);
Try doing this with your RelativeLayout. I added 4 LinearLayouts in your RelativeLayout, all with a weightSum of 3 and moved your TextViews accordingly. I also set their layout_weight parameters to 1 so that they will be stretched across the screen.
I did not test this but it should work.
EDIT : I changed the RelativeLayout to a LinearLayout seeing that all your views are below eachother
<LinearLayout
android:id="#+id/LinearLayoutInside"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/button2"
android:orientation="vertical"
android:background="#drawable/border_bkgrnd" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView12"
android:layout_below="#+id/TextView12"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_alignRight="#+id/textView11"
android:layout_alignTop="#+id/TextView22"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtTitlev1"
android:layout_below="#+id/txtTitlev1"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/TextView31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtTitlev3"
android:layout_alignParentRight="true"
android:layout_below="#+id/txtTitlev3"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
<TextView
android:id="#+id/TextView33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/TextView23"
android:layout_alignBottom="#+id/TextView23"
android:layout_alignLeft="#+id/TextView32"
android:layout_alignParentRight="true"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/txtTitlev1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/TextView21"
android:layout_alignParentLeft="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlLeadid"
android:textColor="#color/Turquoise4"
android:layout_weight="1"
android:textSize="20sp"
android:textStyle="bold|normal"
android:typeface="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/TextView32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView31"
android:layout_alignParentRight="true"
android:layout_below="#+id/TextView31"
android:text="#string/strNA"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView21"
android:layout_below="#+id/TextView21"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/TextView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView22"
android:layout_below="#+id/TextView22"
android:onClick="newActivity"
android:text="Medium Text"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/txtTitlev3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlContact"
android:textColor="#color/Turquoise4"
android:textSize="20sp"
android:layout_weight="1"
android:textStyle="bold|normal" />
<TextView
android:id="#+id/txtTitlev2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:fontFamily="Roboto-BoldCondensed.ttf"
android:text="#string/ttlName"
android:textColor="#color/Turquoise4"
android:textSize="20sp"
android:layout_weight="1"
android:textStyle="bold|normal" />
<TextView
android:id="#+id/TextView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/TextView32"
android:layout_centerHorizontal="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp"
android:layout_weight="1"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
You can use a layout something like this. I used table layout with 3 rows. The first row shows column heading and other rows shows data.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:stretchColumns="*" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp" >
<TextView
android:id="#+id/ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contact"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name 1"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1234567"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="25"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name 2"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="594751"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
</TableLayout>
</LinearLayout>

Android Portions of TextView Invisible

I have some text views in a table layout. When I click a button in my layout parts of the textviews disappear. I have tried restarting eclipse and the emulator a few times, but nothing has changed. I am completely stumped. Any suggestions for why this may be happening? I have posted a before and after screenshot and my xml code for the table layout
Before Click
After Click
Portions of the XML Code...
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/tv_rank"
android:stretchColumns="1" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#acacac"
android:text="Public"
android:textColor="#000000" />
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#acacac"
android:paddingTop="5dp" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.35"
android:text="Parties Thrown:"
android:textColor="#000000"
android:textSize="12dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/tv_PublicPartyAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000000"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" parties"
android:textColor="#000000"
android:textSize="8dp" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.35"
android:text="Average Score:"
android:textColor="#000000"
android:textSize="12dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/tv_PublicAverageScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000000"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" points"
android:textColor="#000000"
android:textSize="8dp" />
</LinearLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#acacac"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.35"
android:text="Biggest Party:"
android:textColor="#000000"
android:textSize="12dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/tv_PublicBiggestParty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000000"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" guests"
android:textColor="#000000"
android:textSize="8dp" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.35"
android:text="Highest Score:"
android:textColor="#000000"
android:textSize="12dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/tv_PublicHighestScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000000"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" points"
android:textColor="#000000"
android:textSize="8dp" />
</LinearLayout>
</TableRow>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="5dp" >
</LinearLayout>
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#acacac"
android:text="Private"
android:textColor="#000000" />
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#acacac"
android:paddingTop="5dp" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.35"
android:text="Parties Thrown:"
android:textColor="#000000"
android:textSize="12dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/tv_PrivatePartyAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000000"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" parties"
android:textColor="#000000"
android:textSize="8dp" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.35"
android:text="Average Score:"
android:textColor="#000000"
android:textSize="12dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/tv_PrivateAverageScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000000"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" points"
android:textColor="#000000"
android:textSize="8dp" />
</LinearLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#acacac"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1.35"
android:text="Biggest Party:"
android:textColor="#000000"
android:textSize="12dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/tv_PrivateBiggestParty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000000"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" guests"
android:textColor="#000000"
android:textSize="8dp" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.35"
android:text="Highest Score:"
android:textColor="#000000"
android:textSize="12dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/tv_PrivateHighestScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#000000"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" guests"
android:textColor="#000000"
android:textSize="8dp" />
</LinearLayout>
</TableRow>
</TableLayout>

after doing getExtra from intent how do i display it in xml

im a noob so please give detailed answers:)
This is the class for get extra wherein i want to display the string
package kfc.project;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class productdetail extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.productdetail);
Intent intent = getIntent();
String str = intent.getStringExtra("name");
}
}
This is where i want the string to be displayed
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:scrollbarAlwaysDrawVerticalTrack="true"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:gravity="top|center"
android:background="#drawable/bg">
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="right">
<Button
android:id="#+id/button1"
android:background="#drawable/button2"
android:textColor="#FFFFFF"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="ADD TO MENU" android:gravity="right" android:paddingRight="4sp" android:paddingTop="10sp"/>
<Button
android:id="#+id/button2"
android:background="#drawable/button2"
android:textColor="#FFFFFF"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="GET TOTAL" android:gravity="right" android:paddingRight="15sp" android:paddingTop="10sp"/>
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Serving Size: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="100"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#android:drawable/divider_horizontal_dark"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:paddingTop="2dp" />
</TableLayout>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="left">
</TableRow>
<TableLayout
android:id="#+id/tableLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="Amount Per Serving: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Calories:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#android:drawable/divider_horizontal_dark"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:paddingTop="2dp" />
<TableRow
android:id="#+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow14"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="% Daily Value: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="35"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
</TableRow>
</TableLayout>
<TableLayout
android:id="#+id/tableLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow9"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Total Fat:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="60"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow10"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Saturated Fat:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="34"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow11"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Trans Fat:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="53"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow12"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cholesterol:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="25"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow13"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sodium:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView26"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow15"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Total Carbohydrate:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView27"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="200"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow16"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Dietary Fiber:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="34"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow17"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Sugars:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView29"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="16"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow18"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Protein:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="40"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#android:drawable/divider_horizontal_dark"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:paddingTop="2dp" />
<TableRow
android:id="#+id/tableRow24"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow19"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
<TableLayout
android:id="#+id/tableLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow20"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow21"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow22"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Vitamin A: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="40"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Vitamin C: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow23"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Calcium: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="35"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Iron: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="40"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow25"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
</LinearLayout>
thank you your answers will be much appreciated
Depending on where you want it to be displayed, you will need to do this at runtime.
//Assign textview and call it tv
TextView tv = (TextView)findViewById(R.id.textView1);
Intent intent = getIntent();
String str = intent.getStringExtra("name");
//set tv text to str
tv.setText(str);
Hope that helps

Categories

Resources