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>
Related
i have this rot to listview:
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:padding="8dp"
android:weightSum="2"
android:layout_marginLeft="18dp"
android:layout_marginTop="18dp"
android:layout_marginRight="18dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_weight="0">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/textView2"
android:text="#string/brand"
android:gravity="center"
android:textSize="16dp"
android:textStyle="bold"
android:layout_margin="2dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/tvBrand"
android:text="MarcaTV"
android:gravity="center"
android:textSize="16dp"
android:textStyle="italic"
android:layout_margin="1dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/textView4"
android:text="#string/type"
android:gravity="center"
android:textSize="16dp"
android:textStyle="bold"
android:layout_margin="1dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/tvType"
android:text="TipoTV"
android:gravity="center"
android:textSize="16dp"
android:textStyle="italic"
android:layout_margin="1dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/textView6"
android:text="#string/model"
android:gravity="center"
android:textSize="16dp"
android:textStyle="bold"
android:layout_margin="1dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/tvModel"
android:gravity="center"
android:textSize="16dp"
android:text="ModelTV"
android:textStyle="italic"
android:layout_margin="1dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/textView8"
android:text="#string/color"
android:gravity="center"
android:textSize="16dp"
android:textStyle="bold"
android:layout_margin="2dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/tvColor"
android:gravity="center"
android:textSize="16dp"
android:text="ColorTV"
android:textStyle="italic"
android:layout_margin="1dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/textView10"
android:text="#string/hand"
android:gravity="center"
android:textSize="16dp"
android:textStyle="bold"
android:layout_margin="2dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/tvHand"
android:gravity="center"
android:textSize="16dp"
android:textStyle="italic"
android:text="ManoTV"
android:layout_margin="1dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_weight="0">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/tvPrice"
android:gravity="center"
android:textSize="32dp"
android:text="10,99"
android:layout_margin="8dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/textView"
android:gravity="center"
android:textSize="32dp"
android:text="€"
android:textStyle="bold"
android:layout_margin="8dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="0"
android:id="#+id/tvQty"
android:textSize="32dp"
android:layout_margin="8dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Unidades"
android:id="#+id/textView11"
android:textSize="16dp"
android:layout_margin="8dp"
android:textStyle="bold"
android:textIsSelectable="false" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="18dp"
android:layout_marginRight="18dp"
android:background="#ffffff"
android:visibility="gone">
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/seekBar"
android:max="100"
android:progress="0"
android:layout_marginBottom="4dp" />
</LinearLayout>
</LinearLayout>
This must be show like this:
But it shows like this:
I dont know why have this margin on bottom...!!
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.
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.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dip" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Total Pregnancies"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="10"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Full Term"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="75dp"
android:text="11"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="190dp"
android:text="Premature"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="12"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_below="#+id/linearLayout1"
android:layout_marginTop="35dp"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Multiples"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="85dp"
android:text="16"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Living"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="95dp"
android:text="17"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_centerVertical="true"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Ab Included"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="70dp"
android:text="13"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Ab Spontaneous"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="14"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="190dp"
android:text="Ectopics"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="35dp"
android:text="15"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
This is how the screen looks, can anyone tell me how can i achieve this layout. i have come up with the layout, but it seems it does not fit for all screens.
Make the LinearLayout width fill_parent to use the entire width of the screen.
Then for each TextView, set the layout_width to 0dp, and set layout_weight to the proportion of the screen you want that view to have.
In the padding, specify the minimum amount you want between the different cells.
For example, if you want the text to occupy double the space of the numbers, use the following code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dip" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:padding="1dip" >
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="Total Pregnancies"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="10"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="Full Term"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="11"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="Premature"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="12"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
Use TableLayout
Here is an example
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>