Use scrollView between two Linear Layout inside a LinearLayout - android

i want to put two scroll view on two layouts that are in inside a main layout .Here is my XML file Please help me on this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/flightResultData"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="#+id/onewayflightLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:src="#drawable/spicejet" />
<TextView
android:id="#+id/onewayflightName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SpiceJet" />
<TextView
android:id="#+id/onewayflightNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9W - 496" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/onewayflightTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="06:00 - 7:05"
android:textSize="12dp" />
<TextView
android:id="#+id/onewayflightDuration"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="1 Hour 35 Min"
android:textSize="10dp" />
<TextView
android:id="#+id/onewayflightstop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="Non Stop"
android:textSize="10dp" />
<TextView
android:id="#+id/onewayflightAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="Rs 200000"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="#+id/retrunflightLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:src="#drawable/spicejet" />
<TextView
android:id="#+id/retrunflightName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SpiceJet" />
<TextView
android:id="#+id/retrunflightNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9W - 496" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/retrunflightTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="06:00 - 7:05"
android:textSize="12dp" />
<TextView
android:id="#+id/retrunflightDuration"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="1 Hour 35 Min"
android:textSize="10dp" />
<TextView
android:id="#+id/resturnflightstop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="Non Stop"
android:textSize="10dp" />
<TextView
android:id="#+id/retrunflightAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="Rs 200000"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
The View i am using to differentiate the two layouts i want those two layout in diffrent scroll view

i think I have understood your issue . you want to separate two views laying two side of Bar with two different scrollView. If it is so then below is solution
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/flightResultData"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="#+id/onewayflightLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:src="#drawable/spicejet" />
<TextView
android:id="#+id/onewayflightName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SpiceJet" />
<TextView
android:id="#+id/onewayflightNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9W - 496" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/onewayflightTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="06:00 - 7:05"
android:textSize="12dp" />
<TextView
android:id="#+id/onewayflightDuration"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="1 Hour 35 Min"
android:textSize="10dp" />
<TextView
android:id="#+id/onewayflightstop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="Non Stop"
android:textSize="10dp" />
<TextView
android:id="#+id/onewayflightAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="Rs 200000"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="#+id/retrunflightLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:src="#drawable/spicejet" />
<TextView
android:id="#+id/retrunflightName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SpiceJet" />
<TextView
android:id="#+id/retrunflightNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9W - 496" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/retrunflightTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="06:00 - 7:05"
android:textSize="12dp" />
<TextView
android:id="#+id/retrunflightDuration"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="1 Hour 35 Min"
android:textSize="10dp" />
<TextView
android:id="#+id/resturnflightstop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="Non Stop"
android:textSize="10dp" />
<TextView
android:id="#+id/retrunflightAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:minLines="1"
android:text="Rs 200000"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>

Related

Contents in ListView not centered

My app retrieves user details from DB and displays in the ListView. However the contents displayed in the ListView are not formatted properly.
This is how my layout is currently rendered:
This is my layout file for the activity:
<RelativeLayout 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:background="#000000"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context=".LeaderBoard" >
<LinearLayout
android:id="#+id/column"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/column_header1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="#string/strLBoardHeaderRank"
android:textColor="#f00"
android:textSize="24sp" />
<TextView
android:id="#+id/column_header2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:text="#string/strLBoardHeaderName"
android:layout_gravity="center"
android:textColor="#f00"
android:textSize="24sp" />
<TextView
android:id="#+id/column_header3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="#string/strLBoardHeaderScore"
android:textColor="#f00"
android:textSize="24sp" />
</LinearLayout>
<ListView
android:id="#+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/column" >
</ListView>
</RelativeLayout>
The layout file for the list activity is below:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" >
<TextView
android:id="#+id/rank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:textColor="#f00"
android:textSize="20sp" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:textColor="#f00"
android:textSize="20sp" />
<TextView
android:id="#+id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:textColor="#f00"
android:textSize="20sp" />
</LinearLayout>
add android:gravity="center" for all textviews and layout file for the list activity textviews width should be 0dp because of weight property and u should also add android:orientation="horizontal"
<TextView
android:id="#+id/column_header1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:text="strLBoardHeaderRank"
android:textColor="#f00"
android:textSize="24sp" />
<TextView
android:id="#+id/column_header2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:gravity="center"
android:text="strLBoardHeaderName"
android:layout_gravity="center"
android:textColor="#f00"
android:textSize="24sp" />
<TextView
android:id="#+id/column_header3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:text="strLBoardHeaderScore"
android:textColor="#f00"
android:textSize="24sp" />
layout file for the list
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="horizontal" >
<TextView
android:id="#+id/rank"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:textColor="#f00"
android:textSize="20sp" />
<TextView
android:id="#+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:gravity="center"
android:textColor="#f00"
android:textSize="20sp" />
<TextView
android:id="#+id/score"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:textColor="#f00"
android:textSize="20sp" />
</LinearLayout>
Try this one, this worked for me
//Main Layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="horizontal" >
<TableLayout
android:id="#+id/add_rule_table"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginTop="5dp"
android:background="#color/list_divider"
android:orientation="vertical"
android:stretchColumns="*"
android:visibility="gone" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:ems="4"
android:gravity="center"
android:text="#string/rule_no"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:ems="4"
android:gravity="center"
android:text="#string/lot"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:ems="4"
android:gravity="center"
android:text="#string/discount"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/list_divider" />
</TableLayout>
<ListView
android:id="#+id/rule_list_view"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_weight="1"
android:background="#android:color/transparent"
android:cacheColorHint="#00000000"
android:choiceMode="none"
android:listSelector="#android:color/transparent" />
</LinearLayout>
//Custom List View Items
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
>
<TableLayout
android:id="#+id/add_rule_table"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginTop="5dp"
android:background="#color/white"
android:orientation="vertical"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:orientation="horizontal" >
<TextView
android:id="#+id/rule_nos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_marginRight="1dp"
android:ems="3"
android:gravity="center_horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="1"
android:textSize="12sp" />
<TextView
android:id="#+id/lots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="23"
android:textSize="12sp" />
<TextView
android:id="#+id/discount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="34%"
android:textSize="12sp" />
<TextView
android:id="#+id/edit_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/edit_rule"
android:ems="4"
android:gravity="center_horizontal"
android:text="#string/edit"
android:textColor="#ffffff"
android:textSize="12sp" />
<TextView
android:id="#+id/delete_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:background="#drawable/delete_rule"
android:ems="4"
android:gravity="center_horizontal"
android:text="#string/delete"
android:textColor="#ffffff"
android:textSize="12sp" />
</TableRow>
</TableLayout>
</LinearLayout>

set linear layout outside the scrollview

I want last two textview in the bottom of the screen and outside the scrollview...but with my code i can get the linear layout inside the scrollview, If i will define them outside the scrollview..It gives me error:root element must be formated at the last linear layout structure
<?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:layout_below="#+id/textView2"
android:background="#drawable/back1"
android:scrollbars="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:layout_marginTop="2dp"
android:text=""
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:text=""
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:text=""
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView5"
android:layout_width="264dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text=""
android:textColor="#FFFFFF" />
<TableLayout
android:id="#+id/maintable"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp" >
</TableLayout>
<TableLayout
android:id="#+id/maintable1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp" >
</TableLayout>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#android:id/list"
android:text=""
android:textColor="#FFFFFF" />
<ListView
android:id="#android:id/list"
style=" android:listViewStyle"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_below="#+id/textView6"
android:layout_marginLeft="33dp"
android:drawSelectorOnTop="true"
android:textColor="#FFFFFF" >
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="0dp"
android:orientation="horizontal"
>
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_gravity="bottom"
android:text=""
android:layout_marginBottom="5dp"
android:textColor="#FFFFFF"
android:textColorLink="#FFFFFF" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="5dp"
android:text=""
android:layout_gravity="bottom"
android:textColor="#FFFFFF"
android:textColorLink="#FFFFFF" />
</LinearLayout>
</LinearLayout>
</ScrollView>
Try this, add/change the design yourself :)
<?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="match_parent"
android:background="#color/darkblue">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/scrollView"
android:scrollbars="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:layout_marginTop="2dp"
android:text="Hello"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:text="Hello"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:text="Hello"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView5"
android:layout_width="264dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="Hello"
android:textColor="#FFFFFF" />
<TableLayout
android:id="#+id/maintable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp" >
</TableLayout>
<TableLayout
android:id="#+id/maintable1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp" >
</TableLayout>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#android:id/list"
android:text="Hello"
android:textColor="#FFFFFF" />
<ListView
android:id="#android:id/list"
style=" android:listViewStyle"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_below="#+id/textView6"
android:layout_marginLeft="33dp"
android:drawSelectorOnTop="true"
android:textColor="#FFFFFF" >
</ListView>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/scrollView"
android:orientation="horizontal">
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_gravity="bottom"
android:text="Hello"
android:layout_marginBottom="5dp"
android:textColor="#FFFFFF"
android:textColorLink="#FFFFFF" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="5dp"
android:text="Hello"
android:layout_gravity="bottom"
android:textColor="#FFFFFF"
android:textColorLink="#FFFFFF" />
</LinearLayout>
</RelativeLayout>

Hel with a Activity design

I'm going crazy with a activity design
I think thah the problem is with the Weights atributes but I'm not sure. The fields of the row on middle contains letters hidding and the button size expands to height (not respond to changes in width and height atributes)
The span atributes is correctly assigned?
This is a snapshot of the activity
This is a summary of the estructure
LinearLayout 1
LinearLayout 1.1
TableLayout
TableRow
LinearLayout 1.2
TableLayout
TableRow con imagen centrada (span=4)
TableRow con 4 Textviews
TableRow con un textview que se modifica(span =2) y un boton de continuar (span=2)
LinearLayout 1.3
TextView
Wich effect have really the weight attribute in nested layouts?
This is the code of activity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/gradient"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp" >
<TableRow android:layout_gravity="center_vertical" >
<ImageView
android:id="#+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:contentDescription="#string/info_pm2"
android:src="#drawable/infomdpi2" />
<TextView
android:id="#+id/info_pm1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/pm3_3"
android:textColor="#FFFFFF"
android:textSize="30sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:background="#drawable/roundcorners"
android:gravity="center_horizontal"
android:paddingBottom="5dp"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:paddingTop="15dp" >
<TableRow
android:layout_weight="5"
android:gravity="center_vertical" >
<ImageView
android:id="#+id/instrtutpm1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="4"
android:layout_weight="1"
android:contentDescription="#string/logo"
android:paddingTop="5dp"
android:src="#drawable/t3_3" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_weight="1" >
<TextView
android:id="#+id/BtnOption0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal|bottom"
android:text="A"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/BtnOption1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal|bottom"
android:text="B"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/BtnOption2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal|bottom"
android:text="C"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/BtnOption3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal|bottom"
android:text="D"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_weight="1"
android:gravity="center_vertical|right" >
<TextView
android:id="#+id/respuesta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_span="3"
android:textStyle="bold" />
<Button
android:id="#+id/BtnNextQ"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="4"
android:text="#string/next" />
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="center|right" >
<TextView
android:id="#+id/large_appname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/large_appname"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
Thanks a lot
Just remove android:layout_span="4" from Button Widget
In your code I observed the button has android:layout_span="4" If you remove this attribute for the button and for textview and make the TableRow to
<TableRow
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center_vertical|right" >
<TextView
android:id="#+id/respuesta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold" />
<Button
android:id="#+id/BtnNextQ"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="next" />
</TableRow>
// try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:background="#android:color/holo_blue_light"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:contentDescription="info_pm2"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/info_pm1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="pm3_3"
android:textColor="#FFFFFF"
android:textSize="30sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="25dp">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/instrtutpm1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="4"
android:contentDescription="logo"
android:paddingTop="5dp"
android:src="#drawable/ic_launcher" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" r>
<TextView
android:id="#+id/BtnOption0"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="A"
android:layout_weight="1"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/BtnOption1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="B"
android:layout_weight="1"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/BtnOption2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="C"
android:layout_weight="1"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/BtnOption3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="D"
android:layout_weight="1"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="#+id/respuesta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold" />
<Button
android:id="#+id/BtnNextQ"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="next" />
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="center"
android:layout_gravity="center|right" >
<TextView
android:id="#+id/large_appname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="large_appname"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>-->
</LinearLayout>

ScrollView in nested layout in Android

I want to apply ScrollView to my entire screen. But scrollview can host only one direct child.
I have tried this:
<?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"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/dialogcreatemainlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/votes_bg"
android:orientation="vertical"
android:padding="5dp" >
<LinearLayout
android:id="#+id/dialogimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="3dp" >
<ImageView
android:id="#+id/dialog_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/dialog_image" />
<ImageView
android:id="#+id/profimage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/member_80" />
<TextView
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#id/profimage"
android:text="By Hermoine - 2 days ago on Politics"
android:textColor="#040404"
android:textSize="12dp"
android:textStyle="normal"
android:typeface="sans" />
</LinearLayout>
<LinearLayout
android:id="#+id/pub_arc_rem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogimage"
android:orientation="horizontal"
android:weightSum="3" >
<Button
android:id="#+id/btnPublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Publish"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnArchive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Archive"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnRemove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Remove"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/pub_arc_rem"
android:layout_marginTop="10dp"
android:text="There Is Nothing Negative In Total Exploitation Of Natural Resources. What Say?"
android:textColor="#343434"
android:textSize="12dp" />
<TextView
android:id="#+id/dialog_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/dialog_title"
android:layout_marginTop="10dp"
android:text="I don&apos;t think you have to believe one or the other. I have personally met christian&apos;s who simply think the big bang is how god created the universe. I have also met atheist who believe that we don&apos;t have the ability to know how the universe began. I have."
android:textColor="#343434"
android:textSize="12dp" />
<View
android:id="#+id/topformline"
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/thumbnail"
android:layout_marginBottom="5dp"
android:layout_marginTop="6dp"
android:background="#android:color/darker_gray"
android:gravity="center" />
<LinearLayout
android:id="#+id/dialog_det"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/list_image"
android:layout_toRightOf="#+id/list_image"
android:layout_weight="5"
android:padding="5dip"
android:text="Last Active: 6 days ago"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:src="#drawable/member" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dip"
android:text="8"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:src="#drawable/udebate_fav" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dp"
android:text="64"
android:textColor="#000000"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/mod_friend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogcreatemainlayout"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/btnAssignModerator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Assign Moderator"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnInviteFriends"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Invite Friends"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
</ScrollView>
Can anyone please guide me?
Thanks.
Wrap the content inside a Contanier. One from FrameLayour, LinearLayout, RelativeLayout
<?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"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- your components -->
</LinearLayout>
</ScrollView>
Here is how its done:
<?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"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/dialogcreatemainlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/votes_bg"
android:orientation="vertical"
android:padding="5dp" >
<LinearLayout
android:id="#+id/dialogimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="3dp" >
<ImageView
android:id="#+id/dialog_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/dialog_image" />
<ImageView
android:id="#+id/profimage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/member_80" />
<TextView
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#id/profimage"
android:text="By Hermoine - 2 days ago on Politics"
android:textColor="#040404"
android:textSize="12dp"
android:textStyle="normal"
android:typeface="sans" />
</LinearLayout>
<LinearLayout
android:id="#+id/pub_arc_rem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogimage"
android:orientation="horizontal"
android:weightSum="3" >
<Button
android:id="#+id/btnPublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Publish"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnArchive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Archive"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnRemove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Remove"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/pub_arc_rem"
android:layout_marginTop="10dp"
android:text="There Is Nothing Negative In Total Exploitation Of Natural Resources. What Say?"
android:textColor="#343434"
android:textSize="12dp" />
<TextView
android:id="#+id/dialog_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/dialog_title"
android:layout_marginTop="10dp"
android:text="I don&apos;t think you have to believe one or the other. I have personally met christian&apos;s who simply think the big bang is how god created the universe. I have also met atheist who believe that we don&apos;t have the ability to know how the universe began. I have."
android:textColor="#343434"
android:textSize="12dp" />
<View
android:id="#+id/topformline"
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/thumbnail"
android:layout_marginBottom="5dp"
android:layout_marginTop="6dp"
android:background="#android:color/darker_gray"
android:gravity="center" />
<LinearLayout
android:id="#+id/dialog_det"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/list_image"
android:layout_toRightOf="#+id/list_image"
android:layout_weight="5"
android:padding="5dip"
android:text="Last Active: 6 days ago"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:src="#drawable/member" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dip"
android:text="8"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:src="#drawable/udebate_fav" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dp"
android:text="64"
android:textColor="#000000"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/mod_friend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogcreatemainlayout"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/btnAssignModerator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Assign Moderator"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnInviteFriends"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Invite Friends"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout>
As you can see the ScrollView must have only one child.
just add vertical linearLyout after scrollview declaration and close the linearLayout before the scrolview tag is closed

how to add single scroll to view and listview in same layout in android

I have a situation, in that situation one view contain imageviews on upper part and list view in the lower part and when we scrolling it is only scroll listview part but i have to scroll whole view simultaneously with single scroll.
I have used add header functionality of list view but in that i have to put seperate xml file of imageview and listview and i need to put them in one xml file. how can i do it..
<ViewFlipper
android:id="#+id/viewFlipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/header_relativelayout" >
<!-- //settings First view Setting -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="3dp"
android:paddingRight="3dp" >
<LinearLayout
android:id="#+id/first_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="10sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_cbk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/cbk_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="20sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_cfb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/cfb_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="20sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_mlb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/mlb_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="10sp"
android:visibility="invisible" />
</LinearLayout>
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="#string/Games_Placebet_chooseteam"
android:textColor="#color/gray"
android:textSize="10sp"
android:textStyle="bold"
android:visibility="invisible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="10sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_nba"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/nba_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="20sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_nfl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/nfl_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="20sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_nhl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/nhl_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="10sp"
android:visibility="invisible" />
</LinearLayout>
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="#string/Games_Placebet_chooseteam"
android:textColor="#color/gray"
android:textSize="12sp"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:id="#+id/middle_line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/first_view"
android:orientation="vertical" >
<ImageView
android:id="#+id/small_line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/small_line" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="f"
android:textColor="#color/gray"
android:textSize="5sp"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:id="#+id/list_header_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/middle_line" >
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dd"
android:textColor="#color/gray"
android:textSize="14sp"
android:visibility="invisible" />
<TextView
android:id="#+id/list_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recent Activities"
android:textColor="#color/gray"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/list_header_layout" >
<ExpandableListView
android:id="#id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/first_view"
android:cacheColorHint="#00000000"
android:childDivider="#android:color/black"
android:divider="#android:color/black"
android:fadingEdge="none"
android:scrollingCache="false" >
</ExpandableListView>
</LinearLayout>
</RelativeLayout>
//settings Second view Setting
<RelativeLayout
android:id="#+id/progressrelative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center_vertical|center_horizontal" >
<ProgressBar
android:id="#+id/progressbar2"
style="#android:style/Widget.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center_vertical|center_horizontal"
android:indeterminate="true"
android:visibility="gone" />
<ListView
android:id="#+id/channellist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/frameLayout"
android:layout_below="#+id/header_relativelayout"
android:cacheColorHint="#00000000"
android:divider="#android:color/transparent"
android:fadingEdge="none"
android:scrollingCache="false" >
</ListView>
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/betView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="8dp" >
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="#string/Games_Placebet_chooseteam"
android:textColor="#color/gray"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/gm4_headar_parch"
android:gravity="center" >
<TextView
android:id="#+id/button_date_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:text="Saturday, 10/27/2012 at 01:00 PM"
android:textColor="#color/white"
android:textSize="13sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="-5dp"
android:background="#drawable/gm4_1white_bg"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<TextView
android:id="#+id/button_hometeam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Denver Broncos"
android:textColor="#color/gray"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView_button_hometeam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/game_click_btn" />
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginTop="8dp"
android:background="#drawable/recent_bigpatch_line" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<TextView
android:id="#+id/button_visitorteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="SD Chargers"
android:textColor="#color/gray"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView_button_visitorteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/game_unclick_btn" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="Betting Amount"
android:textColor="#color/gray"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/upper_relative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/gm4_headar_parch"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="8dp" >
<TextView
android:id="#+id/textView_placebet_balance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:paddingTop="2dp"
android:text="#string/Games_Placebet_balance"
android:textColor="#android:color/white"
android:textSize="16sp"
android:textStyle="bold" />
<!--
<TextView
android:id="#+id/textView_placebet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingRight="32dp"
android:paddingTop="4dp"
android:text="$"
android:textColor="#android:color/white"
android:textStyle="bold" />
-->
<TextView
android:id="#+id/textView_placebet_dollar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingRight="10dp"
android:paddingTop="4dp"
android:text="100"
android:textColor="#android:color/white"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="-5dp"
android:background="#drawable/gm4_1white_bg"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp" >
<TextView
android:id="#+id/button_placebet_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Denver Broncos"
android:textColor="#color/gray"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="#drawable/recent_bigpatch_line" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="3dp"
android:layout_marginTop="10dp" >
<Button
android:id="#+id/button_placebet_up_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:background="#drawable/pg_2_up_arrow_btn" />
<Button
android:id="#+id/textview_placebet_counter_digipanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#drawable/counter_digitaldisplay"
android:textColor="#109EE6" />
<Button
android:id="#+id/button_placebet_counter_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:background="#drawable/pg_2_down_arrow_btn" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<Button
android:id="#+id/button_betaganist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:background="#drawable/bet_against_btn_new"
android:gravity="center_horizontal|center_vertical"
android:paddingBottom="5dp"
android:text="#string/Games_Placebet_betaganist"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<Button
android:id="#+id/button_placebet"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#drawable/placebet_btn_new"
android:gravity="center_horizontal|center_vertical"
android:paddingBottom="5dp"
android:text="Place Bet"
android:textColor="#android:color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<ListView
android:id="#+id/friendlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/frameLayout"
android:layout_below="#+id/header_relativelayout"
android:cacheColorHint="#00000000"
android:divider="#android:color/transparent"
android:fadingEdge="none"
android:scrollingCache="false" >
</ListView>
</ViewFlipper>
here is a code of xml file in which i have used viewflipper and in that i have added views so the first view is image view on upper side listview on the lower side when we click on image view next view will flip and so on... but in the first view it is scrolling only listview part i need to scroll whole view with single scroll.
THanks in advance..
The issue is, all the possible ways to mix in two scrolls does not yield well ( to best of my knowledge), Setting the header xml is probably the best approach for it. try to find a way around the situation.

Categories

Resources