My layout is split into 3 sections (see screenshot). When the soft keyboard appears it partly hides section 1 and completely hides section 2. However, I need it to hide only section 2 and keep 1 and 3 fully visible. I tried using ScrollView as the outermost view but it leads to overlapping the section 3 when keyboard pops up instead of pushing it upwards. Can you suggest some solution on how to achieve this?
Layout code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/formWeHandelswareColor"
android:weightSum="10">
<TableLayout
android:id="#+id/Anlieferungkopf"
android:layout_width="match_parent"
android:layout_weight="2.5"
android:layout_height="0dp">
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_column="1"
android:textColor="#android:color/black"
android:text="Scan NVE"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextScanNve"
android:layout_column="2"
android:textColor="#android:color/black"
android:width="120dp"
android:layout_gravity="bottom"
android:layout_span="2"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:layout_column="4"
android:textColor="#android:color/black"
android:text="Ord. Lief."
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxAccepted"
android:layout_column="5"
android:layout_gravity="center_vertical"/>
<TextView
android:layout_column="6"
android:textColor="#android:color/black"
android:text="Platz"
android:layout_gravity="center_vertical"/>
<Spinner
android:id="#+id/spinnerPlace"
android:layout_column="7"
android:layout_gravity="center_vertical"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_column="1"
android:textColor="#android:color/black"
android:text="WE Nummer"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextReceiptNo"
android:layout_column="2"
android:layout_span="2"
android:textColor="#android:color/black"
android:layout_width="fill_parent"
android:layout_gravity="bottom"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:layout_column="4"
android:textColor="#android:color/black"
android:text="Lieferant"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextVendor"
android:enabled="false"
android:layout_column="5"
android:textColor="#android:color/black"
android:textSize="14dip"
android:layout_span="5"
android:width="120dp"
android:layout_gravity="bottom"
android:singleLine="true"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_column="1"
android:textColor="#android:color/black"
android:text="Bestellnummer"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextBestellnummer"
android:layout_column="2"
android:layout_width="150dip"
android:textColor="#android:color/black"
android:textSize="14dip"
android:layout_gravity="bottom"
android:singleLine="true"/>
<Button
android:id="#+id/btnAvisOrderNo"
android:layout_column="3"
android:text="->"/>
<TextView
android:layout_column="4"
android:textColor="#android:color/black"
android:text="LKW Temp.-Stat."
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxLkwTempStat"
android:layout_column="5"
android:layout_gravity="center_vertical"/>
<TextView
android:layout_column="6"
android:textColor="#android:color/black"
android:text="Temp. LKW"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextTempLKW"
android:layout_column="7"
android:textColor="#android:color/black"
android:width="120dp"
android:layout_gravity="bottom"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:layout_column="8"
android:textColor="#android:color/black"
android:text="Warentemp."
android:layout_gravity="center_vertical"/>
<EditText
android:layout_column="9"
android:id="#+id/editTextWarentemp"
android:width="120dp"
android:textColor="#android:color/black"
android:textSize="14dip"
android:singleLine="true"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_column="1"
android:textColor="#android:color/black"
android:text="Frachtführer"
android:layout_gravity="center_vertical"/>
<Spinner
android:id="#+id/spinnerCarrier"
android:layout_column="2"
android:layout_span="2"
android:layout_gravity="bottom"/>
<TextView
android:layout_column="4"
android:textColor="#android:color/black"
android:text="KFZ Kennz."
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextKfzKennz"
android:layout_column="5"
android:textColor="#android:color/black"
android:width="120dp"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:layout_column="6"
android:textColor="#android:color/black"
android:text="Fahrer"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextFahrer"
android:layout_column="7"
android:textColor="#android:color/black"
android:width="120dp"
android:singleLine="true"
android:textSize="14dip" />
</TableRow>
<TableRow
android:layout_height="0dp">
<Button
android:id="#+id/buttonCreateGoodsReceipt"
android:layout_column="1"
android:layout_span="3"
android:text="Wareneing. erstellen"/>
<Button
android:id="#+id/buttonFinishGoodsReceipt"
android:layout_column="4"
android:layout_span="3"
android:text="Wareneing. abschließen"/>
<Button
android:id="#+id/buttonCancelDelivery"
android:layout_column="7"
android:layout_span="3"
android:text="Anlieferung ablehnen"/>
</TableRow>
</TableLayout>
<TableLayout
android:id="#+id/Anliefungpos"
android:layout_width="match_parent"
android:layout_weight="3.5"
android:layout_height="0dp"
android:stretchColumns="*">
<!--Headers-->
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="8">
<TextView
android:text="Artikel"
android:textSize="18dip"
android:textColor="#android:color/black"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:text="Benennung"
android:textSize="18dip"
android:textColor="#android:color/black"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:text="Menge Avis"
android:textSize="18dip"
android:textColor="#android:color/black"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:text="Einheit"
android:textSize="18dip"
android:textColor="#android:color/black"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:text="Menge gelief."
android:textSize="18dip"
android:textColor="#android:color/black"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:text="Anz. Pal."
android:textSize="18dip"
android:textColor="#android:color/black"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:text="NVE"
android:textSize="18dip"
android:textColor="#android:color/black"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:text="Status"
android:textSize="18dip"
android:textColor="#android:color/black"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</TableRow>
<ListView
android:listSelector="#drawable/ListViewRowSelector"
android:id="#+id/ListViewAnliefungPos"/>
</TableLayout>
<TableLayout
android:id="#+id/AnlieferungPositionLHM"
android:layout_width="match_parent"
android:layout_weight="4"
android:layout_height="0dp">
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_column="1"
android:textColor="#android:color/black"
android:text="Scan NVE/GS1"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextLhmScanNve"
android:layout_column="2"
android:width="250dp"
android:textColor="#android:color/black"
android:singleLine="true"
android:textSize="14dip" />
<Button
android:id="#+id/btnOpenScan"
android:layout_column="3"
android:text="Scan abschließen"
android:layout_gravity="center_vertical"/>
<TextView
android:layout_column="8"
android:textColor="#android:color/black"
android:text="Qualitätssicherung"
android:layout_gravity="top"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<EditText
android:id="#+id/editTextNotifications"
android:layout_column="1"
android:textColor="#android:color/black"
android:layout_height="wrap_content"
android:layout_span="7"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:layout_column="8"
android:textColor="#android:color/black"
android:text="Le defekt"
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxLeDefect"
android:layout_column="9"
android:layout_gravity="bottom"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="Artikel"
android:textColor="#android:color/black"
android:layout_width="0dp"
android:layout_column="1"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextItem"
android:textColor="#android:color/black"
android:layout_column="2"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:id="#+id/textViewItemDescr"
android:textColor="#android:color/black"
android:layout_column="3"
android:layout_span="5"
android:layout_gravity="center_vertical"/>
<TextView
android:text="Ordnungsstatus"
android:textColor="#android:color/black"
android:layout_column="8"
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxOrdnungsstatus"
android:layout_column="9"
android:layout_gravity="bottom"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_column="1"
android:textColor="#android:color/black"
android:text="Charge"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextCharge"
android:textColor="#android:color/black"
android:layout_column="2"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:layout_column="8"
android:textColor="#android:color/black"
android:text="Sauberkeitsstatus"
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxSauberkeitsstatus"
android:layout_column="9"
android:layout_gravity="bottom"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="MHD"
android:textColor="#android:color/black"
android:layout_column="1"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextMHD"
android:textColor="#android:color/black"
android:layout_column="2"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:text="Prod.-Datum"
android:textColor="#android:color/black"
android:layout_column="4"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextProdDate"
android:textColor="#android:color/black"
android:layout_column="5"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:layout_column="8"
android:textColor="#android:color/black"
android:text="Schädlingsstatus"
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxSchaedlingsstatus"
android:layout_column="9"
android:layout_gravity="bottom"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="Menge"
android:textColor="#android:color/black"
android:layout_column="1"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextMenge"
android:textColor="#android:color/black"
android:layout_column="2"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:textColor="#android:color/black"
android:layout_column="3"
android:layout_gravity="center_vertical"
android:id="#+id/textViewItemUom"/>
<TextView
android:text="Geometrie"
android:textColor="#android:color/black"
android:layout_column="4"
android:layout_gravity="center_vertical"/>
<Spinner
android:id="#+id/spinnerItemGeometry"
android:layout_column="5"
android:layout_width="150dp"
android:layout_gravity="center_vertical"/>
<TextView
android:layout_column="8"
android:textColor="#android:color/black"
android:text="Warentemp."
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextLhmWarentemp"
android:layout_column="9"
android:layout_width="50dip"
android:layout_gravity="center_vertical"
android:textColor="#android:color/black"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:layout_column="10"
android:textColor="#android:color/black"
android:text="Warentemp.-Status"
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxWarentempstatus"
android:layout_column="11"
android:layout_gravity="bottom"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="LHM-Nr."
android:textColor="#android:color/black"
android:layout_column="1"
android:layout_gravity="center_vertical"/>
<EditText
android:id="#+id/editTextLHMNr"
android:layout_gravity="center_vertical"
android:layout_column="2"
android:textColor="#android:color/black"
android:singleLine="true"
android:textSize="14dip" />
<TextView
android:text="LHM Typ"
android:textColor="#android:color/black"
android:layout_column="4"
android:layout_gravity="center_vertical"/>
<Spinner
android:id="#+id/spinnerLhmType"
android:layout_column="5"
android:layout_width="150dp"
android:layout_gravity="center_vertical"/>
<TextView
android:text="LHM Höhe"
android:textColor="#android:color/black"
android:layout_column="6"
android:layout_gravity="center_vertical"/>
<Spinner
android:id="#+id/spinnerLhmHeight"
android:layout_column="7"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"/>
<TextView
android:layout_column="8"
android:textColor="#android:color/black"
android:text="Altersstatus"
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxAltersstatus"
android:layout_column="9"
android:layout_gravity="bottom"/>
<TextView
android:layout_column="10"
android:textColor="#android:color/black"
android:text="Palettenstatus"
android:layout_gravity="center_vertical"/>
<CheckBox
android:id="#+id/checkBoxPalettenstatus"
android:layout_column="11"
android:layout_gravity="bottom"/>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<Button
android:id="#+id/btnPostLe"
android:layout_column="1"
android:text="LHM buchen"/>
<Button
android:id="#+id/btnWeCancel"
android:layout_column="2"
android:text="Abbrechen"/>
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
Looks like you want to Resize your Activity when the SoftInput is showing.
So first, remove your outer ScrollView as you don't want to scroll everything.
Then on your Activity in the ActivityAttribute add a WindowSoftInputMode specification like:
[Activity(WindowSoftInputMode = SoftInput.AdjustResize | SoftInput.StateHidden)]
Now when the keyboard is showing, it should resize the Activity and your views.
Try to check if the keyboard is open and use VISIBILITY / GONE.
aktivityMainRelativLayout = (RelativeLayout)findViewById(R.id.main);
aktivityMainRelativLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
#Override
public void onGlobalLayout() {
int heightDiff = aktivityMainRelativLayout.getRootView().getHeight() - aktivityMainRelativLayout.getHeight();
if (heightDiff > 100) {
//keyboard open
anliefungposLayout.setVisibility(View.GONE);
} else {
//keyboard close
anliefungposLayout.setVisibility(View.VISIBLE);
}
}
});
Related
I have an android layout with some title bar and some input fields, and when I try to input some values, I can do it, but
the title bar vanishes
If I want to edit the field "Another number" I cannot scroll down to use the SeekBar instead.
How can I change the layout to make it
Have the title bar (with the text "InputExample") always fixes
Have the other content of the screen scrollable (so that I can use the SeekBar, for example)?
The layout is here:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccccc"
android:layout_marginBottom = "0dp">
<GridLayout
android:id="#+id/grid"
android:layout_margin="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="#+id/new_cancel"
android:alignmentMode="alignBounds"
android:columnCount="10"
android:columnOrderPreserved="false"
android:useDefaultMargins="true">
<TextView
android:id="#+id/textTitleEdit"
android:layout_column="0"
android:layout_columnSpan="10"
android:layout_gravity="center_horizontal"
android:layout_row="0"
android:text="My Title"
android:textSize="32dip"/>
<TextView
android:text="You can enter some values"
android:textSize="16dip"
android:layout_columnSpan="8"
android:layout_gravity="left"
android:id="#+id/textSubTitleEdit"
android:layout_row="1"
android:layout_column="0" />
<TextView
android:text="Name"
android:layout_gravity="right"
android:layout_row="2"
android:layout_column="0"
/>
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_name"
android:layout_row="2"
android:layout_column="1" />
_____________
<TextView
android:text="Label"
android:layout_gravity="right"
android:layout_row="3"
android:layout_column="0" />
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_label"
android:layout_row="3"
android:layout_column="1" />
______
<TextView
android:layout_column="0"
android:text="Put in a number"
android:layout_gravity="right"
/>
<EditText
android:ems="7"
android:singleLine="true"
android:id="#+id/new_price"
android:inputType="numberDecimal"
android:layout_row="4"
android:layout_column="1" />
<TextView
android:layout_column="0"
android:text="Another number"
android:layout_gravity="right"
android:layout_row="5" />
<EditText
android:ems="7"
android:singleLine="true"
android:id="#+id/new_offset"
android:inputType="number"
android:layout_row="5"
android:layout_column="1" />
<SeekBar
android:id="#+id/seek_offset"
style="#android:style/Widget.Holo.SeekBar"
android:layout_width="150dp"
android:layout_column="1"
android:layout_row="6"
android:max="20"/>
<TextView
android:text="Comment"
android:layout_gravity="right"
android:layout_row="7"
android:layout_column="0" />
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_comment"
android:layout_row="7"
android:layout_column="1" />
</GridLayout>
<Button
android:id="#+id/new_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#aaaaaa"
android:text="Cancel"
android:layout_margin="5dp"
/>
<Button
android:id="#+id/new_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="#dddddd"
android:text="Ok"
android:layout_margin="5dp"
/>
</RelativeLayout>
</FrameLayout>
Was having some problems with your original layout so I've fixed it up and I think this solution should work. Everything in the preview of the layout has it positioned correctly so hopefully when you use this in the emulator it should work.
I personally prefer using LinearLayouts with weights for the majority of my layouts, I know some others prefer RelativeLayouts.
Essentially you should look to contain the part which you wish to scroll with a layout of some kind and then the ScrollView contains this layout so it can be scrolled. This is why I've removed the title and subtitle from the GridLayout.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccccc"
android:weightSum="6">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:orientation="vertical"
android:gravity="bottom|center_horizontal">
<TextView
android:id="#+id/textTitleEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="My Title"
android:textSize="32dip"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="You can enter some values"
android:textSize="16dip"
android:layout_gravity="center_horizontal"
android:id="#+id/textSubTitleEdit"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<GridLayout
android:id="#+id/grid"
android:layout_margin="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alignmentMode="alignBounds"
android:columnCount="10"
android:columnOrderPreserved="false"
android:useDefaultMargins="true">
<TextView
android:text="Name"
android:layout_gravity="right"
android:layout_row="2"
android:layout_column="0"/>
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_name"
android:layout_row="2"
android:layout_column="1"/>
<TextView
android:text="Label"
android:layout_gravity="right"
android:layout_row="3"
android:layout_column="0"/>
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_label"
android:layout_row="3"
android:layout_column="1" />
<TextView
android:layout_column="0"
android:text="Put in a number"
android:layout_gravity="right"
/>
<EditText
android:ems="7"
android:singleLine="true"
android:id="#+id/new_price"
android:inputType="numberDecimal"
android:layout_row="4"
android:layout_column="1" />
<TextView
android:layout_column="0"
android:text="Another number"
android:layout_gravity="end"
android:layout_row="5" />
<EditText
android:ems="7"
android:singleLine="true"
android:id="#+id/new_offset"
android:inputType="number"
android:layout_row="5"
android:layout_column="1" />
<SeekBar
android:id="#+id/seek_offset"
style="#android:style/Widget.Holo.SeekBar"
android:layout_width="150dp"
android:layout_column="1"
android:layout_row="6"
android:max="20"/>
<TextView
android:text="Comment"
android:layout_gravity="right"
android:layout_row="7"
android:layout_column="0" />
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_comment"
android:layout_row="7"
android:layout_column="1" />
</GridLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:gravity="bottom|center_horizontal"
android:weightSum="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:layout_weight="1">
<Button
android:id="#+id/new_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity=""
android:background="#aaaaaa"
android:text="Cancel"
android:layout_margin="5dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:layout_weight="1">
<Button
android:id="#+id/new_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#dddddd"
android:text="Ok"
android:layout_margin="5dp"/>
</RelativeLayout>
</LinearLayout>
I am a beginner android programmer with a fair amount of Java background, mostly on a mainframe. (Yes it runs on a mainframe). I writing an app that tracks some daily activity, and after the default RealativeLayout I am adding a TableLayout via XML. In my onWindowFocusChanged I am also trying to set the width of the TableLayout. When I measure the two, the RelativeLayout is 1024, the screen size, but the TableLayout is 960. The XML and code snippet are below. Any help would be greatly appreciated as I have done many searches and a lot of Doc, and still can't get this to match.
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/WeekTbar"
android:stretchColumns="*"
android:shrinkColumns="*"
android:layout_alignParentLeft="true"
android:id="#+id/table"
android:background="#d4fbff">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0ff2D2Bf"
>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:layout_column="0"
android:background="#2d2bff"
android:textColor="#ffffff"
android:text=" " />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText2"
android:layout_column="1"
android:text="Sun"
android:textColor="#ffffff"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText3"
android:layout_column="2"
android:text="Mon"
android:background="#2d2bff"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText4"
android:layout_column="3"
android:text="Tue"
android:textColor="#ffffff"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText6"
android:layout_column="4"
android:text="Wed"
android:background="#2d2bff"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText5"
android:layout_column="5"
android:text="Thu"
android:textColor="#ffffff"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText8"
android:layout_column="6"
android:text="Fri"
android:background="#2d2bff"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText9"
android:layout_column="7"
android:text="Sat"
android:textColor="#ffffff"
android:background="#2d2bff" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0ff2D2Bf"
android:focusableInTouchMode="true">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText10"
android:layout_column="0"
android:text="Steps"
android:background="#2d2bff"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/SunSteps"
android:layout_column="1"
android:background="#2d2bff"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/MonSteps"
android:layout_column="2"
android:textColor="#ffffff"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/TueSteps"
android:layout_column="3"
android:background="#2d2bff"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/WedSteps"
android:layout_column="4"
android:textColor="#ffffff"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ThuSteps"
android:layout_column="5"
android:background="#2d2bff"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/FriSteps"
android:layout_column="6"
android:textColor="#ffffff"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/SatSteps"
android:layout_column="7"
android:background="#2d2bff" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0ff2D2Bf">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText11"
android:layout_column="0"
android:text=Cals"
android:textColor="#ffffff"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/SunCals"
android:layout_column="1"
android:focusableInTouchMode="true"
android:background="#2d2bff"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/MonCals"
android:layout_column="2"
android:textColor="#ffffff"
android:focusableInTouchMode="true"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/TueCals"
android:layout_column="3"
android:background="#2d2bff"
android:focusableInTouchMode="true"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/WedCals"
android:layout_column="4"
android:textColor="#ffffff"
android:focusableInTouchMode="true"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ThuCals"
android:layout_column="5"
android:background="#2d2bff"
android:focusableInTouchMode="true"
android:textColor="#ffffff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/FriCals"
android:layout_column="6"
android:textColor="#ffffff"
android:focusableInTouchMode="true"
android:background="#2d2bff" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText7"
android:layout_column="7"
android:background="#2d2bff"
android:focusableInTouchMode="true"
android:textColor="#ffffff" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0ff2D2Bf">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText12"
android:layout_column="0"
android:text="Wgt"
android:background="#2d2bff"
android:textColor="#ffffff" />
</TableRow>
</TableLayout>
Java code
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus == true) {
TableLayout table = (TableLayout) findViewById(R.id.table);
RelativeLayout rl = (RelativeLayout)findViewById(R.id.RelativeLayout);
int layoutWidth = rl.getWidth();
int layoutHeight = rl.getHeight();
table.getLayoutParams().width = layoutWidth;
table.setMinimumWidth(layoutWidth);
gw = table.getWidth();
rw = layoutWidth;
int x =1;
}
}
If you only want your table layout width match RelativeLayout width you shouldn't need to support multiple xml element.
Your problem maybe cause when you support android:padding in RelativeLayout or android:layout_margin in TableLayout.
Check the simple code below
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:padding="10dp" // remove it
android:layout_height="match_parent" >
...
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000"
android:layout_margin="10dp" // remove it
>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
.... >
</TableRow>
....
</TableLayout>
</RelativeLayout>
See more about android layout margin and padding in this
Hope this help
I am having a check box with in table layout of five columns and i had placed check boxes in the last column of my table layout but it was not placing at the center of the column can any one tell me how to place check boxes at the center of the column in the table layout in android
This is my xml
<TableLayout
android:id="#+id/table_layout_manual_mode"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
>
<TableRow
android:id="#+id/After_connection_heading_one"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#673AB7" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="CHECK ON J14"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</TableRow>
<TableRow
android:id="#+id/tableRow1_manual"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center" >
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="0.35"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_15_Sno"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1.5"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_15_Description"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:id="#+id/textView3"
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/Test_Point_15"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:id="#+id/textView4"
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_15_Range"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<CheckBox
android:id="#+id/cb_1"
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center"
/>
</TableRow>
<TableRow
android:id="#+id/tableRow2_manual"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center" >
<TextView
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="0.35"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_16_Sno"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1.5"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_16_Description"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/Test_Point_16"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_16_Range"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<CheckBox
android:id="#+id/cb_2"
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center" />
</TableRow>
<TableRow
android:id="#+id/tableRow3_manual"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center" >
<TextView
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="0.35"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_17_Sno"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1.5"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_17_Description"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/Test_Point_17"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<TextView
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center"
android:text="#string/TP_17_Range"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<CheckBox
android:id="#+id/cb_3"
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1"
android:background="#drawable/cell_shape"
android:gravity="center" />
</TableRow>
</TableLayout>
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>
Below given is my layout which is I am using for displaying a table, which have a number of rows. the problem is this table have more no of rows than the screen can contain, so i want rows to be scrollable so that if i scroll down i can reach to the rows which is not visible in current screen.
i used isScrollContainer="true" bur this does not solve my problem
Can you please suggest which property can i use to solve the problem
<TableLayout android:layout_height="wrap_content" android:isScrollContainer="true" >
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="center">
<View android:layout_gravity="center" android:layout_height="30px"
android:background="#android:color/darker_gray"
android:layout_width="400px" />
<TextView android:layout_width="wrap_content" style="#style/styleName"
android:id="#+id/tv_add_ticket" android:text="Update Ticket on Assembloid Space"
android:layout_height="wrap_content" android:layout_marginLeft="5px"
android:layout_marginRight="2px" android:layout_marginTop="2px"
android:layout_marginBottom="2px">
</TextView>
</RelativeLayout>
</TableLayout>
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20px" android:isScrollContainer="true"
xmlns:android="http://schemas.android.com/apk/res/android"
android:baselineAligned="true" android:background="#565051"
android:layout_marginTop="50px">
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/ticket_status"
android:text="Status " android:layout_column="1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=":"
android:layout_column="2" android:layout_marginTop="5px"
android:layout_marginRight="5px" />
<!-- <EditText android:layout_width="250px" android:layout_height="wrap_content"
android:id="#+id/et_ticket_status"></EditText> -->
<Spinner android:layout_width="100px" android:layout_height="wrap_content"
android:id="#+id/spn_up_ticket_status"></Spinner>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/ticket_priority"
android:text="Priority" android:layout_column="1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=":"
android:layout_column="2" android:layout_marginTop="5px"
android:layout_marginRight="5px" />
<Spinner android:layout_width="200px" android:layout_height="wrap_content"
android:id="#+id/spn_up_ticket_priority"></Spinner>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/ticket_summary"
android:text="Summary" android:layout_column="1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=":"
android:layout_column="2" android:layout_marginTop="5px"
android:layout_marginRight="5px" />
/>
<EditText android:layout_width="250px" android:id="#+id/et_ticket_summary"
android:layout_height="wrap_content" android:autoText="true">
</EditText>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/ticket_discription"
android:text="Discription" android:layout_column="1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=":"
android:layout_column="2" android:layout_marginTop="5px"
android:layout_marginRight="5px" />
/>
<EditText android:layout_width="250px" android:id="#+id/et_ticket_Discription"
android:layout_height="wrap_content" android:autoText="true"></EditText>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/estimated_hour"
android:text="Estimated Hours" android:layout_column="1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=":"
android:layout_column="2" android:layout_marginTop="5px"
android:layout_marginRight="5px" />
/>
<EditText android:layout_width="250px" android:id="#+id/et_estimated_hour"
android:layout_height="wrap_content" android:autoText="true"></EditText>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/worked_hour"
android:text="Worked Hours" android:layout_column="1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=":"
android:layout_column="2" android:layout_marginTop="5px"
android:layout_marginRight="5px" />
<EditText android:layout_width="250px" android:id="#+id/et_worked_hour"
android:layout_height="wrap_content" android:autoText="true"></EditText>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/ticket_comment"
android:text="Comment" android:layout_column="1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=":"
android:layout_column="2" android:layout_marginTop="5px"
android:layout_marginRight="5px" />
/>
<EditText android:layout_width="250px" android:id="#+id/et_ticket_comment"
android:layout_height="wrap_content" android:autoText="true">
</EditText>
</TableRow>
<TableRow>
<Button android:layout_width="wrap_content" android:text="Comments"
android:layout_height="wrap_content" android:id="#+id/comment_ticket_button" android:layout_column="1" ></Button>
<Button android:layout_width="wrap_content" android:text="#string/update_ticket"
android:layout_height="wrap_content" android:id="#+id/update_ticket_button" android:layout_column="3"></Button>
</TableRow>
<TextView android:id="#+id/error_ticket_text"
android:layout_centerHorizontal="true" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_below="#+id/login_button" />
You should wrap your TableLayout inside a ScrollView with appropriate height
<ScrollView android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="100dp">
<TableLayout..>
</TableLayout>
</ScrollView>
You should use ScrollView as the root layout to solve your problem.