I will just cut to the chase and paste all of my xml for a particular Activity below. The problem I'm having is that the widgets are not wrapping, and so much of the text is bleeding off the right edge of the screen.
As I'm using "wrap_content" for the width, I don't understand why this is happening.
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/textViewSendLocWhenItChanges"
android:text="Send My Pterodactyl When It Changes"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<CheckBox
android:id="#+id/checkBoxSendToSelectedDuckbilledPlatypiWhenPterodactylChanges"
android:text="Send My Pterodactyl to Selected Duckbilled Platypi When It Changes" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<Button
android:id="#+id/buttonSendOnPterodactylChangedToSelected"
android:layout_weight="1"
android:text="Select Recipients From Contacts" />
<TextView android:layout_weight="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<TextView
android:layout_span="1"
android:layout_weight="1"
android:text="Send Pterodactyl to selected Duckbilled Platypi from Contact List when my Pterodactyl changes by more than the following number of miles:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editTextMilesBeforeNotification"
android:layout_width="200px"
android:layout_span="1"
android:layout_weight="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<TextView android:layout_height="10px" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<TextView android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/textViewBuildStringOfWhoReceivesChangeOfPterodactylUpdates"
android:layout_width="wrap_content"
android:text="Your Pterodactyl will be immediately sent to "
android:textAppearance="?android:attr/textAppearanceSmall" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<TextView android:layout_height="40px" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<Button
android:id="#+id/buttonNext"
android:layout_weight="1"
android:text="Save and Exit Keep In Touch Configuration" />
<TextView
android:layout_weight="1" />
</TableRow>
</TableLayout>
layout_width does not apply to TableRows. Use layout_span when you have a single column spanning two columns. Try using android:shrinkColumns. Hope it helps.
Related
I am designing a login page which has EditText and TextView for username & password and buttons for sign-in & reset. I need to place my buttons in a single column so that the first column should be empty and second column should have 2 buttons. Can anyone help me.
Thanks in advance.
This is my xml code.
<TableLayout
android:id="#+id/con1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25pt"
android:layout_marginRight="25pt"
android:gravity="center"
android:orientation="vertical" >
<TableRow android:layout_width="match_parent" android:gravity="center">
<TextView
android:id="#+id/lbl_heading"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_x="76px"
android:layout_y="24px"
android:text="SignIn Here"
android:gravity="center"
>
</TextView>
</TableRow>
<TableRow android:layout_width="fill_parent">
<TextView
android:id="#+id/lbl_username"
android:layout_width="20pt"
android:layout_height="wrap_content"
android:layout_x="19px"
android:layout_y="57px"
android:gravity="left"
android:text="Username"
android:layout_weight="0.5">
</TextView>
<EditText
android:id="#+id/txt_username"
android:layout_width="20pt"
android:layout_height="wrap_content"
android:layout_x="54px"
android:layout_y="80px"
android:textSize="18sp"
android:layout_weight="0.5">
</EditText>
</TableRow>
<TableRow>
<TextView
android:id="#+id/lbl_password"
android:layout_width="20pt"
android:layout_height="wrap_content"
android:layout_x="21px"
android:layout_y="131px"
android:text="Password"
android:layout_weight="0.5">
</TextView>
<EditText
android:id="#+id/txt_password"
android:layout_width="20pt"
android:layout_height="47px"
android:layout_x="53px"
android:layout_y="155px"
android:password="true"
android:textSize="18sp"
android:layout_weight="0.5">
</EditText>
</TableRow>
<TableRow>
<LinearLayout >
<Button
android:id="#+id/btn_signin"
android:layout_width="80pt"
android:layout_height="wrap_content"
android:layout_x="52px"
android:layout_y="200px"
android:text="SignIn"
android:layout_weight="0.025">
</Button>
<Button
android:id="#+id/btn_reset"
android:layout_width="80pt"
android:layout_height="wrap_content"
android:layout_x="123dp"
android:layout_y="201px"
android:text="Reset"
android:layout_weight="0.025">
</Button>
</LinearLayout>
</TableRow>
</TableLayout>
If you want to follow this shady logic, i suggest using
<Space/>
or
<android.support.v4.widget.Space>
The docs say
Space is a lightweight View subclass that may be used to create gaps between components in general purpose layouts.
You can set column number with android:layout_column argument
<TableRow>
<TextView
android:layout_column="1"
android:text="Save As..."
android:padding="3dip" />
<TextView
android:text="Ctrl-Shift-S"
android:gravity="right"
android:padding="3dip" />
</TableRow>
try this:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/con1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25pt"
android:layout_marginRight="25pt"
android:gravity="center"
android:orientation="vertical" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<TextView
android:id="#+id/lbl_heading"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_x="76px"
android:layout_y="24px"
android:text="SignIn Here"
android:gravity="center"
>
</TextView>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_x="19px"
android:layout_y="57px"
android:gravity="left"
android:text="Username" >
</TextView>
<EditText
android:id="#+id/txt_username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_x="54px"
android:layout_y="80px"
android:textSize="18sp" >
</EditText>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_x="21px"
android:layout_y="131px"
android:text="Password" >
</TextView>
<EditText
android:id="#+id/txt_password"
android:layout_width="0dp"
android:layout_height="47px"
android:layout_weight="1"
android:layout_x="53px"
android:layout_y="155px"
android:password="true"
android:textSize="18sp" >
</EditText>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="#+id/btn_signin"
android:layout_width="80pt"
android:layout_height="wrap_content"
android:layout_x="52px"
android:layout_y="200px"
android:text="SignIn"
android:layout_weight="0.025">
</Button>
<Button
android:id="#+id/btn_reset"
android:layout_width="80pt"
android:layout_height="wrap_content"
android:layout_x="123dp"
android:layout_y="201px"
android:text="Reset"
android:layout_weight="0.025">
</Button>
</LinearLayout>
</TableRow>
</TableLayout>
Output:
Not sure what I am doing wrong, but I am trying to put 5 check boxes in a single table row. The row seems to end after the first check box, and the remaining 4 check boxes are appearing outside the row. Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:id="#+id/txtView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:typeface="serif"
android:textSize="18sp"
android:text="#string/start_head"
android:gravity="center"
android:layout_span="5"
android:layout_marginTop="10dp" >
</TextView>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp" >
<CheckBox
android:id="#+id/chkAtm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/atm" />
<CheckBox
android:id="#+id/chkGift"
android:layout_width="wrap_content"
android:text="#string/giftcard" />
<CheckBox
android:id="#+id/chkRing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/ring" />
<CheckBox
android:id="#+id/chkMerchant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/merchant" />
<CheckBox
android:id="#+id/chkCod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/cod" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<Button
android:id="#+id/btnRun"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="#string/run"
android:layout_span="5" />
</TableRow>
</TableLayout>
Your second CheckBox hasn't got android:layout_height, check it ;)
My app contains header,edittext,listview and footer
It works fine...but when soft keyboard is open for edittext my footer comes up.
I had also set android:windowSoftInputMode="adjustPan" in manifest.
my layout is as below
<?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="fill_parent"
android:background="#drawable/middle_bg"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/header1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<include
android:id="#+id/header2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
layout="#layout/header" />
</RelativeLayout>
<TableLayout
android:id="#+id/tbllayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/header1"
>
<TableRow
android:layout_gravity="left"
android:background="#drawable/tit_bg" >
<TextView
android:id="#+id/lbltit"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:gravity="center"
android:text="Registered Websites"
android:textSize="20dp"
android:textStyle="bold" />
<Button
android:id="#+id/btnAddNewRege"
android:layout_gravity="center_vertical"
android:layout_weight="3"
android:background="#drawable/plus"
android:gravity="left" />
</TableRow>
<TableRow android:layout_width="fill_parent" >
<View
android:id="#+id/vwhr1"
android:layout_width="fill_parent"
android:layout_height="10dip"
android:layout_span="2" />
</TableRow>
<TableRow>
<EditText
android:id="#+id/txtSearch"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#drawable/roundedtextview"
android:hint="Search"
android:textSize="13dp"
android:width="280sp"
/>
<Button
android:id="#+id/btnSearchMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/search"
android:gravity="center" />
</TableRow>
<TableRow android:layout_width="fill_parent" >
<View
android:id="#+id/vwhr"
android:layout_width="fill_parent"
android:layout_height="10dip"
android:layout_span="2" />
</TableRow>
</TableLayout>
<LinearLayout
android:id="#+id/tblftr"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:isScrollContainer="true"
>
<TableLayout
android:id="#+id/btnpanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stretchColumns="*" >
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/black"
>
<Button
android:id="#+id/btnSetting"
android:layout_weight="1"
android:background="#drawable/settings"
android:width="40dp" />
<Button
android:id="#+id/btnAboutUs"
android:background="#drawable/about_us"
android:width="100dp" />
<Button
android:id="#+id/btnFeedback"
android:background="#drawable/feedback"
android:width="100dp" />
</TableRow>
<TableRow>
<include
android:id="#+id/include1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
layout="#layout/footer" />
</TableRow>
</TableLayout>
</LinearLayout>
<ListView
android:id="#+id/lst"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#id/tblftr"
android:layout_below="#id/tbllayout"
android:cacheColorHint="#android:color/transparent"
android:layout_centerHorizontal="true" >
</ListView>
</RelativeLayout>
pls guide
Thanks & Regards
Mita
You could try and put your RelativeLayout in a ScrollView. This might not worked as intended if the ListView doesn't fill the screen since you would have to declare layout_width="wrap_content" for your RelativeLayout inside the ScrollView and that would bring your footer right bellow the ListView.
Try it and see if it fits your model.
I'm probably missing something obvious here but I can't seem to figure this out. I am looking for a result like 1, 5, or 6, a single row of 3 evenly distributed buttons that fill the width of the screen. Unfortunately however, each of these methods seem to have something wrong with them. 1 gives me a warning that "This TableRow layout or its TableLayout parent is possibly useless" and 5 and 6 give "Nested weights are bad for performance". So basically I'm wondering what the best way to do this is. Should I ignore the warning on no.1 or can I get them to display properly with just a TableRow or TableLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >
<!-- No.1 -->
<TableLayout android:id="#+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="*" >
<TableRow android:id="#+id/tbRow0" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<Button android:id="#+id/btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num1" />
<Button android:id="#+id/btn2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num2" />
<Button android:id="#+id/btn3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num3" />
</TableRow>
</TableLayout>
<!-- No.2 -->
<TableRow android:id="#+id/tbRow1" android:layout_width="fill_parent" android:layout_height="wrap_content" >
<Button android:id="#+id/btn4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num1" />
<Button android:id="#+id/btn5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num2" />
<Button android:id="#+id/btn6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num3" />
</TableRow>
<!-- No.3 -->
<TableRow android:id="#+id/tbRow2" android:layout_width="fill_parent" android:layout_height="wrap_content" >
<Button android:id="#+id/btn7" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="#string/num1" />
<Button android:id="#+id/btn8" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="#string/num2" />
<Button android:id="#+id/btn9" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="#string/num3" />
</TableRow>
<!-- No.4 -->
<TableRow android:id="#+id/tbRow3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="*" >
<Button android:id="#+id/btn10" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num1" />
<Button android:id="#+id/btn11" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num2" />
<Button android:id="#+id/btn12" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num3" />
</TableRow>
<!-- No.5 -->
<TableRow android:id="#+id/tbRow4" android:layout_width="fill_parent" android:layout_height="wrap_content" >
<Button android:id="#+id/btn13" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num1" />
<Button android:id="#+id/btn14" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num2" />
<Button android:id="#+id/btn15" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num3" />
</TableRow>
<!-- No.6 -->
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" >
<Button android:id="#+id/btn16" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num1" />
<Button android:id="#+id/btn17" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num2" />
<Button android:id="#+id/btn18" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num3" />
</LinearLayout>
<!-- No.7 -->
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" >
<Button android:id="#+id/btn19" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num1" />
<Button android:id="#+id/btn20" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num2" />
<Button android:id="#+id/btn21" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#string/num3" />
</LinearLayout>
</LinearLayout>
I think 5 is the correct one, plus I'm not getting the nested weights warning.
Maybe it's related to what Agarwal pointed.
Edit: sorry I though 5 was using a LinearLayout. What I mean is:
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" >
<Button android:id="#+id/btn13" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num1" />
<Button android:id="#+id/btn14" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num2" />
<Button android:id="#+id/btn15" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="#string/num3" />
</LinearLayout>
In your xml file after first row you are closing tablelayout but even you are using table rows in 2 ,5 rows might be that a problem.
If you need it for only one then then better to have linearlayout because performance not to bad because you have a small xml file which is ok.
I'm trying to put the buttonbar I've created on the bottom of each screen. I've succeeded for the first screen fairly easy.
Now I've tried to put it other screens, but it seems that it can't stick to the bottom of the screen. When I look in the hiearchyviewer, it looks like the RelativeLayout that's wrapped araound my layout and buttonbar, isn't filling the whole screen, though, its height is set to fill parent.
Can anyone help me by pointing out where I'm going wrong?
This is the XML I use:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="5pt" android:id="#+id/table"
android:stretchColumns="1">
<TableRow>
<TextView android:text="#string/Arbeiderbediende"
android:id="#+id/txtArbeiderBediende" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow android:gravity="center">
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal"
android:id="#+id/group1">
<RadioButton style="#style/RadioButton"
android:layout_width="wrap_content" android:id="#+id/rbArbeider"
android:text="#string/Arbeider" android:layout_height="wrap_content"
android:paddingLeft="18pt" />
<RadioButton style="#style/RadioButton"
android:layout_width="wrap_content" android:id="#+id/rbBediende"
android:text="#string/Bediende" android:layout_height="wrap_content"
android:layout_marginLeft="20pt" android:paddingLeft="18pt" />
</RadioGroup>
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/OverzichtFuncties"
android:id="#+id/txtFuncties" android:layout_width="0dip"
android:layout_weight="1" android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content" style="Spinner"
android:layout_width="0dip" android:layout_weight="2"
android:id="#+id/cmbFuncties" />
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/Regio" android:id="#+id/txtRegio"
android:layout_width="0dip" android:layout_weight="1"
android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_weight="2" android:id="#+id/cmbRegio" />
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/Opleiding" android:id="#+id/txtOpleidingsniveau"
android:layout_width="0dip" android:layout_weight="1"
android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_weight="2"
android:id="#+id/cmbOpleidingsniveau" />
</TableRow>
<Button android:text="#string/VindJobButton" android:id="#+id/btnFindJob"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_marginTop="10dip" />
</TableLayout>
<stage.accent.Toolbar android:layout_width="fill_parent"
android:layout_height="70dip" android:layout_alignParentBottom="true"
android:layout_below="#+id/table" />
</RelativeLayout>
This is the result I achieved and the result I want to get
In case you want your buttonbar to be always visible at the bottom of the screen and not scroll with the content, you might want to switch your RelativeLayout and ScrollView tags, and move your buttonbar to be the first child of your RelativeLayout, the ScrollView to be the second:
<?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="fill_parent" android:orientation="vertical">
<stage.accent.Toolbar android:id="id/buttonBar" android:layout_width="fill_parent"
android:layout_height="70dip" android:layout_alignParentBottom="true" />
<ScrollView android:layout_above="#+id/buttonBar"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="5pt" android:id="#+id/table"
android:stretchColumns="1">
<TableRow>
<TextView android:text="#string/Arbeiderbediende"
android:id="#+id/txtArbeiderBediende" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow android:gravity="center">
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal"
android:id="#+id/group1">
<RadioButton style="#style/RadioButton"
android:layout_width="wrap_content" android:id="#+id/rbArbeider"
android:text="#string/Arbeider" android:layout_height="wrap_content"
android:paddingLeft="18pt" />
<RadioButton style="#style/RadioButton"
android:layout_width="wrap_content" android:id="#+id/rbBediende"
android:text="#string/Bediende" android:layout_height="wrap_content"
android:layout_marginLeft="20pt" android:paddingLeft="18pt" />
</RadioGroup>
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/OverzichtFuncties"
android:id="#+id/txtFuncties" android:layout_width="0dip"
android:layout_weight="1" android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content" style="Spinner"
android:layout_width="0dip" android:layout_weight="2"
android:id="#+id/cmbFuncties" />
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/Regio" android:id="#+id/txtRegio"
android:layout_width="0dip" android:layout_weight="1"
android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_weight="2" android:id="#+id/cmbRegio" />
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/Opleiding" android:id="#+id/txtOpleidingsniveau"
android:layout_width="0dip" android:layout_weight="1"
android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_weight="2"
android:id="#+id/cmbOpleidingsniveau" />
</TableRow>
<Button android:text="#string/VindJobButton" android:id="#+id/btnFindJob"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_marginTop="10dip" />
</TableLayout>
</ScrollView>
</RelativeLayout>
This way you'll be able to achieve what you want:
and
The button bar will be always at the bottom of your screen.
And by scrolling the content, you'll be able to see the last bit of it too, it won't be hidden behind the buttonbar:
I still suggests dont use ScrollView here is an example how you can show the ButtonBar at the bottom
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/headerlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
>
<Button android:id="#+id/amap_back_btn" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" android:text="Back">
</Button>
<TextView android:id="#+id/amap_txt"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="" android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
</TextView>
<ImageButton android:id="#+id/amap_action_btn"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="#drawable/icon_menu_action"
android:layout_alignParentTop="true" android:layout_alignParentRight="true">
</ImageButton>
</RelativeLayout>
//What ever widgets you wants to add
<LinearLayout
android:id="#+id/bottomlayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal"
>
<ImageButton android:id="#+id/map_refresh_btn"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="#drawable/icon_refresh"
android:gravity="center"
>
</ImageButton>
<Button android:id="#+id/map_log_btn" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Log"
android:gravity="center">
</Button>
<Button android:id="#+id/map_map_btn" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Map"
android:gravity="center"
>
</Button>
</LinearLayout>
</RelativeLayout>
that is all this is the most robust solution.
If you find it useful dont forget to mark it as an answer.
Please take one main linear layout
above scroll view and after ending
scroll view please set your bottom
bar..
It would be also my suggetion.
LinearLayout is the main view.
Within it
Another LinearLayout (layout_height=0dp and layout_weight = 1) *ll_container*
and you tabbar
Within *ll_container* place
a scrollview (layout_height=0dp and layout_weight = 1) with tablelayout
and the button
Probably for explanation. With layout_height=0dp and layout_weight = 1 you give your layouts the whole free place remaining after placing your tabbar and then after placing your button
UPD
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<ScrollView android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="5pt" android:id="#+id/table"
android:stretchColumns="1">
<TableRow>
<TextView android:text="#string/Arbeiderbediende"
android:id="#+id/txtArbeiderBediende" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow android:gravity="center">
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal"
android:id="#+id/group1">
<RadioButton style="#style/RadioButton"
android:layout_width="wrap_content" android:id="#+id/rbArbeider"
android:text="#string/Arbeider" android:layout_height="wrap_content"
android:paddingLeft="18pt" />
<RadioButton style="#style/RadioButton"
android:layout_width="wrap_content" android:id="#+id/rbBediende"
android:text="#string/Bediende" android:layout_height="wrap_content"
android:layout_marginLeft="20pt" android:paddingLeft="18pt" />
</RadioGroup>
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/OverzichtFuncties"
android:id="#+id/txtFuncties" android:layout_width="0dip"
android:layout_weight="1" android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content" style="Spinner"
android:layout_width="0dip" android:layout_weight="2"
android:id="#+id/cmbFuncties" />
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/Regio" android:id="#+id/txtRegio"
android:layout_width="0dip" android:layout_weight="1"
android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_weight="2" android:id="#+id/cmbRegio" />
</TableRow>
<TableRow android:gravity="center" android:paddingTop="5dip">
<TextView android:text="#string/Opleiding" android:id="#+id/txtOpleidingsniveau"
android:layout_width="0dip" android:layout_weight="1"
android:layout_height="wrap_content" />
<Spinner android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_weight="2"
android:id="#+id/cmbOpleidingsniveau" />
</TableRow>
</TableLayout>
</ScrollView>
<Button android:text="#string/VindJobButton" android:id="#+id/btnFindJob"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_marginTop="10dip" />
</LinearLayout>
<stage.accent.Toolbar android:layout_width="fill_parent"
android:layout_height="70dip" android:layout_alignParentBottom="true"
android:layout_below="#+id/table" />
</LinearLayout>