Android application layout issue - android

Hi all i am new to android development ..
In my application I want to display a layout as like this image:
But I am getting this image instead:
here is my code :- http://www.freefilehosting.net/bookingform_1
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bg" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/BookingFormRoomLabel"
android:textColor="#android:color/white" />
<Spinner
android:id="#+id/roomspinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/BookingFormDocTypeLabel"
android:textColor="#android:color/white" />
<Spinner
android:id="#+id/DocTypeSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/BookingFormAdultsLabel"
android:textColor="#android:color/white" />
<Spinner
android:id="#+id/AdultsSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
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="#string/BookinFormChildrensLabel"
android:textColor="#android:color/white" />
<Spinner
android:id="#+id/ChildrensSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/BookingFormNightsLabel"
android:textColor="#android:color/white" />
<Spinner
android:id="#+id/NightSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TabHost
android:id="#android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2" >
<ImageView
android:id="#+id/MainImageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_weight="1"
android:contentDescription="#string/BookingFormMainImage"
android:src="#drawable/documentsample" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="Button" />
</TableRow>
</LinearLayout>
<LinearLayout
android:id="#+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/SubImageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:contentDescription="#string/BookingFormSubImage"
android:src="#drawable/documentsample" />
<Button
android:id="#+id/BtnSubImageCapture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="#string/BtnBookingFormSubImageCapture" />
<Button
android:id="#+id/BtnSubImageBrowse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center"
android:text="#string/BtnBookingFormSumbImageBrowse" />
<Button
android:id="#+id/BtnSubImageDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center_vertical|center"
android:text="#string/BtnBookingFormSubImageDelete" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</TableRow>

Just add one more LinearLayout kept layout orientation as vertical and kept those button's in that layout.
<LinearLayout
android:id="#+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/SubImageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:contentDescription="#string/BookingFormSubImage"
android:src="#drawable/documentsample" />
<LinearLayout
android:id="#+id/buttons_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="#+id/BtnSubImageCapture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="#string/BtnBookingFormSubImageCapture" />
<Button
android:id="#+id/BtnSubImageBrowse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center"
android:text="#string/BtnBookingFormSumbImageBrowse" />
<Button
android:id="#+id/BtnSubImageDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center_vertical|center"
android:text="#string/BtnBookingFormSubImageDelete" />
<LinearLayout/>
</LinearLayout>

Related

Expand button in TableRow

I have at the bottom of the screen 2 buttons for next and previous inside table rows in a table layout as below.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" >
<TableLayout
android:id="#+id/table1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#000000"
>
<TableRow
android:background="#000000"
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:textColor="#FFFFFF"
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView />
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:textColor="#FFFFFF"
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:visibility="gone"
/>
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="visible"
/>
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:textColor="#FFFFFF"
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="fill"
>
<Button
android:id="#+id/next"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="goNext"
android:text="Next" />
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="#+id/previous"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="goPrevious"
android:text="Previous" />
</TableRow>
</TableLayout>
</ScrollView>
</LinearLayout>
However, The buttones next and previous don't fill the row. I want to expand both buttons to fill the row (parent)? Any suggestions?
Use Layout_weight for Buttons
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" >
<TableLayout
android:id="#+id/table1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#000000"
>
<TableRow
android:background="#000000"
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:textColor="#FFFFFF"
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView />
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:textColor="#FFFFFF"
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:visibility="gone"
/>
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="visible"
/>
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:textColor="#FFFFFF"
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="fill"
>
<Button
android:id="#+id/next"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="goNext"
android:layout_weight="1"
android:text="Next" />
</TableRow>
<TableRow
android:background="#000000"
android:id="#+id/tableRow6"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/previous"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="goPrevious"
android:layout_weight="1"
android:text="Previous" />
</TableRow>
</TableLayout>
</ScrollView>
</LinearLayout>
I changed it copy and Paste It will work
Thanks
Change TableRow layout_width="match_parent" around buttons

Android: Two LinearLayout overlap in ScrollView

I have an Android layout issue.
I have (1) a ScrollView (2) a TableLayout (3) a footer LinearLayout.
Currently, if the TableRow is too many, the Table will overlap the footer Layout.
The following is my xml layout.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F7F7F7">
<LinearLayout
android:id="#+id/account_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Head Text" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC">
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC">
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="2" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC">
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="3" />
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/footer_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<ImageView
android:id="#+id/footer_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/footer_image" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/footer_height"
android:background="#333333">
<TextView
android:id="#+id/usage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Test" />
<TextView
android:id="#+id/dashboard_copy_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="#string/copy_right" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
If the TableRow is too many, the "table" will overlap the "footer".
How to solve this layout issue?
Thanks in advance.
Eric
Add screenshot
Use this layout and see if it works
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footer_section" >
<LinearLayout
android:id="#+id/account_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Head Text" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="1" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="2" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#CCCCCC" >
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="3" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/footer_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
<ImageView
android:id="#+id/footer_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#333333" >
<TextView
android:id="#+id/usage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Test" />
<TextView
android:id="#+id/dashboard_copy_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="copy_right" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

alignment issue with my android app

I am having alignment issue with my app.
as of this moment, the layout of my app is on the left side but I want to center it
no matter what I try or set it just wont be on the center of the android device's screen
Below is the layout xml code of my app
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<FrameLayout
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:text="XXX" />
</FrameLayout>
<FrameLayout
android:layout_width="160dp"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/XXX"
android:layout_width="160dp"
android:layout_height="180dp"
android:layout_gravity="right"
android:background="#ff777777"
android:clickable="true"
android:scaleType="centerCrop"
android:src="#drawable/XXX" />
</FrameLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<FrameLayout
android:layout_width="160dp"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/XXX"
android:layout_width="160dp"
android:layout_height="176dp"
android:layout_gravity="right"
android:background="#ff777777"
android:scaleType="centerCrop"
android:src="#drawable/XXX" />
</FrameLayout>
<FrameLayout
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<TextView
android:id="#+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:text="XXX" />
</FrameLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<FrameLayout
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:text="XXX" />
</FrameLayout>
<FrameLayout
android:layout_width="160dp"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/XXX"
android:layout_width="160dp"
android:layout_height="177dp"
android:layout_gravity="right"
android:background="#ff777777"
android:scaleType="centerCrop"
android:src="#drawable/XXX" />
</FrameLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<FrameLayout
android:layout_width="160dp"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/XXX"
android:layout_width="160dp"
android:layout_height="176dp"
android:layout_gravity="right"
android:background="#ff777777"
android:scaleType="centerCrop"
android:src="#drawable/XXX" />
</FrameLayout>
<FrameLayout
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<TextView
android:id="#+id/TextView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:text="XXX" />
</FrameLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<Button
android:id="#+id/btnStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="Start" />
<Button
android:id="#+id/btnExit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Exit" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
Simply just this properties to all TableRow :
android:gravity="center"
Add weightsum=2 to and add layout_weight=1 to innner

Android Multipane ListView Search(List Filter)

I developed application with multipane .I need to give listview filtering.I have modified #android:layout/list_content file.But it didn't show Edittext.
My code is : activity_invoice_twopane.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<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" >
<TextView
android:id="#+id/invRetName"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:text="ABCD Stores"
android:textColor="#color/black"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/invlasttxtDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Last Invoice Date : "
android:textColor="#color/black"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/invlastInDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2013-07-20 14:25:48"
android:textColor="#color/black"
android:textSize="20dp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:baselineAligned="false"
android:divider="?android:attr/dividerHorizontal"
android:orientation="horizontal"
android:showDividers="middle"
tools:context=".sale.InvocieBrandActivity" >
<fragment
android:id="#+id/item_list"
android:name="com.xont.hemas.controller.sale.InvoiceBrandListFragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginTop="70dp"
android:background="#drawable/list_item_selector"
tools:layout="#android:layout/list_content" />
<FrameLayout
android:id="#+id/item_detail_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" >
</FrameLayout>
</LinearLayout>
This is my edited list_content.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="#+id/progressContainer"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:gravity="center">
<ProgressBar style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/loading"
android:paddingTop="4dip"
android:singleLine="true" />
</LinearLayout>
<FrameLayout android:id="#+id/listContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText android:id="#+id/inputSearch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Search Brands"
/>
<ListView android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="false" />
<TextView android:id="#+android:id/internalEmpty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
</FrameLayout>
Please tell me what i want to do for show list filtering functionality.
Thanks in advance.

Android Horizontal Scroll View

i have a layout having many fields and i wish to add scrollbars for both horizontal and vertical layout.But vertical scroll is working horizontal scroll is not working.I have loaded the text fields dynamically in program and add the fields with web service .
My Activity
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/LayoutScroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="horizontal|vertical" >
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="10dp"
android:layout_marginTop="30dp"
android:gravity="fill|fill_horizontal"
android:orientation="vertical" >
<TableRow
android:id="#+id/Row_User_Deletion"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DF0101"
android:gravity="center" >
<TextView
android:id="#+id/user_creation_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/txt_delete_user_userDeletion"
android:textColor="#color/white"
android:textSize="15dp" />
</TableRow>
<TableRow
android:id="#+id/RowUserType"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="10dp" >
<TextView
android:id="#+id/txt_delete_user_selectuserType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="#string/txt_delete_user_selectuserType"
android:textColor="#424242" />
<Spinner
android:id="#+id/spin_delete_userType"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_marginBottom="5dp"
android:entries="#array/utype" />
<Button
android:id="#+id/btn_spinner_user_search_select"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="5dp"
android:background="#drawable/redbtn"
android:text="#string/btn_delete_user_search_user" />
</TableRow>
<TableRow
android:id="#+id/deleteUserRow"
android:layout_width="match_parent"
android:layout_height="34dp"
android:layout_marginTop="10dp"
android:gravity="fill" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/txt_user_creation_userId"
android:textColor="#424242" />
<EditText
android:id="#+id/txt_user_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="#+id/button1"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:background="#drawable/redbtn"
android:text="#string/btn_delete_user_search_user" />
</TableRow>
<TableLayout
android:id="#+id/delete_userDetails_Table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:stretchColumns="*" >
<TableRow
android:id="#+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:background="#color/red" >
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:text="#string/txt_delete_user_select"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView3"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:text="#string/txt_user_creation_userId"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:text="#string/txt_user_creation_userName"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView5"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:text="#string/txt_delete_user_UserRole"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/txt_componentmaster_createdDate"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/txt_componentmaster_createdBy"
android:textColor="#color/white" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
ImageView
Please keep in mind that the view that you want to scroll Horizontal is must have LinearLayout as parent then only you can set the HorizontalScrollView between that layout.
And Put one HorizontalScrollView as the Parent of those both LinearLayout.
Hope this will help you.
Smple:
<HORIZONTAL_VIEW ... >
<!-- Your First Layout -->
<LinearLayout ... >
</LinearLayout>
<!-- Your Second Layout -->
<LinearLayout ... >
</LinearLayout>
</HORIZONTAL_VIEW ... >
Hope you got my point.
Feel free for any query. :)
Try the Scroll Bars with out the Scrollview..
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="10dp"
android:layout_marginTop="30dp"
android:gravity="fill|fill_horizontal"
android:scrollbars="horizontal|vertical"
android:orientation="vertical" >
<TableRow
android:id="#+id/Row_User_Deletion"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DF0101"
android:gravity="center" >
<TextView
android:id="#+id/user_creation_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/txt_delete_user_userDeletion"
android:textColor="#color/white"
android:textSize="15dp" />
</TableRow>
<TableRow
android:id="#+id/RowUserType"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="10dp" >
<TextView
android:id="#+id/txt_delete_user_selectuserType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="#string/txt_delete_user_selectuserType"
android:textColor="#424242" />
<Spinner
android:id="#+id/spin_delete_userType"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_marginBottom="5dp"
android:entries="#array/utype" />
<Button
android:id="#+id/btn_spinner_user_search_select"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="5dp"
android:background="#drawable/redbtn"
android:text="#string/btn_delete_user_search_user" />
</TableRow>
<TableRow
android:id="#+id/deleteUserRow"
android:layout_width="match_parent"
android:layout_height="34dp"
android:layout_marginTop="10dp"
android:gravity="fill" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/txt_user_creation_userId"
android:textColor="#424242" />
<EditText
android:id="#+id/txt_user_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="#+id/button1"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:background="#drawable/redbtn"
android:text="#string/btn_delete_user_search_user" />
</TableRow>
<TableLayout
android:id="#+id/delete_userDetails_Table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:stretchColumns="*" >
<TableRow
android:id="#+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:background="#color/red" >
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:text="#string/txt_delete_user_select"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView3"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:text="#string/txt_user_creation_userId"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView4"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:text="#string/txt_user_creation_userName"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView5"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:text="#string/txt_delete_user_UserRole"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/txt_componentmaster_createdDate"
android:textColor="#color/white" />
<TextView
android:id="#+id/textView5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/txt_componentmaster_createdBy"
android:textColor="#color/white" />
</TableRow>
</TableLayout>
</LinearLayout>

Categories

Resources