I would like to realize a LinearLayout in Android like this:
{ deleted image }
but I don't know how to do.
If I do:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="60dp" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="60dp" >
<TextView android:text="TextView" android:id="#+id/item_0"
android:layout_width="wrap_content"
android:layout_height="30dp" >
</TextView>
<TextView android:text="TextView" android:id="#+id/item_1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:textSize="18dp"
android:textColor="#ff0000">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="80dp"
android:gravity="right"
android:layout_height="60dp" >
<TextView android:text="TextView" android:id="#+id/item_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textColor="#ff0000">
</TextView>
</LinearLayout>
</LinearLayout>
The second LinearLayout (on the right) is not shown. I think I would have to use a RelativeLayout, but how can I draw a similar LinearLayout?
This is the layout used for a ListItem in a ListView so every box has to have the same width (hence cannot use wrap_content for the 2 item_0 and item_1 layout wrapper.
Try adding android:layout_weight="1" to your first child LinearLayout inside the top level LinearLayout (i.e. the one on the 5th line of your XML):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="60dp">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="60dp" android:layout_weight="1">
<TextView android:text="TextView" android:id="#+id/item_0"
android:layout_width="wrap_content" android:layout_height="30dp">
</TextView>
<TextView android:text="TextView" android:id="#+id/item_1"
android:layout_width="wrap_content" android:layout_height="30dp"
android:textSize="18dp" android:textColor="#ff0000">
</TextView>
</LinearLayout>
<LinearLayout android:layout_width="80dp" android:gravity="right"
android:layout_height="60dp">
<TextView android:text="TextView" android:id="#+id/item_2"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:textSize="20dp" android:textColor="#ff0000">
</TextView>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="60dp" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_weight="70">
<TextView android:text="TextView" android:id="#+id/item_0"
android:layout_width="wrap_content"
android:layout_height="30dp" >
</TextView>
<TextView android:text="TextView" android:id="#+id/item_1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:textSize="18dp"
android:textColor="#ff0000">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_weight="30"
android:layout_width="80dp"
android:gravity="right"
android:layout_height="60dp" >
<TextView android:text="TextView" android:id="#+id/item_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textColor="#ff0000">
</TextView>
</LinearLayout>
</LinearLayout>
http://developer.android.com/resources/articles/layout-tricks-efficiency.html
so more efficient way will be this layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="60dp">
<TextView android:text="TextView" android:id="#+id/item_2"
android:layout_width="80dp" android:layout_alignParentTop="true"
android:layout_height="60dp" android:textSize="20dp"
android:textColor="#ff0000" android:layout_alignParentRight="true">
</TextView>
<TextView android:text="TextView" android:id="#+id/item_0"
android:layout_width="fill_parent" android:layout_height="30dp"
android:layout_toLeftOf="#id/item_2">
</TextView>
<TextView android:text="TextView" android:id="#+id/item_1"
android:layout_width="fill_parent" android:layout_height="30dp"
android:textSize="18dp" android:textColor="#ff0000"
android:layout_below="#id/item_0" android:layout_toLeftOf="#id/item_2">
</TextView>
</RelativeLayout>
Related
I have a listview which contains a linearlayout. I am trying to get the linearlayout to the center of the screen(horizontally) but it doesn't work.
How it looks -
Portrait -
Landscape -
I want the linearlayout(which has the text "text" and the two images) to come to the center of the screen(horizontally) in both the orientations.
I've tried using layout_gravity on the linearlayout but it doesn't work.
Here's my code -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#EEEEEE" >
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/parentListContainer">
</ListView>
</LinearLayout>
Each listview item -
<?xml version="1.0" encoding="utf-8"?>
<!-- I want this layout centered. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textColor="#000000"
android:text="text"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="#+id/ivBottle1"
android:scaleType="fitXY"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"/>
<TextView
android:id="#+id/tvBottle1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top|center"
android:text="vino"
android:textSize="22sp" >
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="#+id/ivBottle2"
android:scaleType="fitXY"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"/>
<TextView
android:id="#+id/tvBottle2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top|center"
android:text="vino"
android:textSize="22sp" >
</TextView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Please help.
EDIT: Neither gravity="center" works on the listview, nor does layout_gravity="center" on the linearlayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#EEEEEE" >
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="#+id/parentListContainer">
</ListView>
</LinearLayout>
See here for explanation : https://stackoverflow.com/a/3482757/4706693
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textColor="#000000"
android:text="text"/>
<LinearLayout
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="#+id/ivBottle1"
android:scaleType="fitXY"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"/>
<TextView
android:id="#+id/tvBottle1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top|center"
android:text="vino"
android:textSize="22sp" >
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="#+id/ivBottle2"
android:scaleType="fitXY"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"/>
<TextView
android:id="#+id/tvBottle2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top|center"
android:text="vino"
android:textSize="22sp" >
</TextView>
</LinearLayout>
</LinearLayout>
I am trying to show a textbox and checkbox in a row. But are not seems to be alligned. Also the elements of gridview are not alligned .
My code is as following :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<GridView
android:id="#+id/gridView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:horizontalSpacing="10dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp" >
</GridView>
</LinearLayout>
and the code of gridview_row.xml :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/border"
android:padding="5dp" >
<LinearLayout
android:id="#+id/layout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/textViewL"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="TextView"
android:textSize="18sp" />
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right" />
</LinearLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_below="#+id/layout1"
android:layout_centerHorizontal="true"
android:src="#drawable/icon"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:ellipsize="marquee"
android:gravity="center"
android:text="TextView"
android:textSize="18sp" />
</RelativeLayout>
I want to allign textview and checkbox in a row. Also the elements of gridview must be alligned . Please help me in this regards .
Try this.
IN TWO WAYS
Give android:gravity="center_vertical" for both TextView and CheckBox
then LinearLayout height as fixed like 40dp
<LinearLayout
android:id="#+id/layout1"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/textViewL"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="TextView"
android:gravity="center_vertical"
android:textSize="18sp" />
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical" />
</LinearLayout>
then the second
NO need to give fixed
<LinearLayout
android:id="#+id/layout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/textViewL"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="TextView"
android:gravity="center_vertical"
android:textSize="18sp" />
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:gravity="right" />
</LinearLayout>
For your GridView allignment
use android:singleLine="true"
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:ellipsize="marquee"
android:gravity="center"
android:singleLine="true"
android:text="TextView"
android:textSize="18sp" />
use android:gravity="center_vertical" in your textView
Try this
<?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="#00868B" >
<LinearLayout
android:id="#+id/layout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/textViewL"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="TextView"
android:textSize="18sp" />
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right" />
</LinearLayout>
</RelativeLayout>
// try this way and let me know still you have any problem
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/lnrmain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/border"
android:gravity="center"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:id="#+id/textViewL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right" />
</LinearLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="64dp"
android:layout_height="64dp"
android:src="#drawable/ic_launcher"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:gravity="center"
android:text="TextView"
android:layout_marginTop="5dp"
android:textSize="18sp" />
</LinearLayout>
I would like to make a rather complex layout. Can someone help me, as how to do my layout.xml ?
Layout image
No. 1 is a Layout (Table, Linear etc)
No. 2 is my listview, containing a row of list_details.xml
Edit: so far I managed to do the first part
<TableLayout android:layout_height="wrap_content" android:layout_width="fill_parent">
<TableRow android:layout_width="wrap_content" android:stretchColumns="0,2" android:layout_marginTop="2sp" android:layout_height="wrap_content" >
<TextView android:id="#+id/homeTeam" android:layout_weight="2" android:paddingRight="4sp"/>
<TextView android:text="Vs" android:layout_weight="0" />
<TextView android:id="#+id/awayTeam" android:layout_weight="2" android:gravity="right" android:paddingLeft="4sp"/>
</TableRow>
</TableLayout>
<ListView android:id="#id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ListView>
EDIT:
Well i probably didn't explain well what i want to do. Here is a screenshot of my app
My current layout
I want the columns to align. So far i am using this xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:stretchColumns="0,4" xmlns:android="http://schemas.android.com/apk/res/android">
<TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:id="#+id/ll_playerHome" android:layout_weight="0.5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12sp"/>
<ImageView android:id="#+id/ll_eventHome" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="#+id/ll_minute" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<ImageView android:id="#+id/ll_eventAway" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="#+id/ll_playerAway" android:layout_weight="0.5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:textSize="12sp"/>
</TableRow>
</TableLayout>
This might do the trick:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="#+id/linearLayout1">
<TextView android:layout_width="wrap_content" android:text="TextView"
android:id="#+id/textView1" android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_height="wrap_content" android:layout_weight="1"
android:gravity="center_horizontal"></TextView>
<TextView android:text="TextView" android:id="#+id/textView2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal"></TextView>
<TextView android:layout_width="wrap_content" android:text="TextView"
android:id="#+id/textView3" android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_height="wrap_content" android:layout_weight="1"
android:gravity="center_horizontal"></TextView>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="#+id/linearLayout2">
<ListView android:layout_height="wrap_content" android:id="#+id/listView1"
android:layout_weight="1" android:layout_width="fill_parent"></ListView>
<TextView android:text="TextView" android:id="#+id/textView2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal"></TextView>
<ListView android:layout_height="wrap_content" android:id="#+id/listView1"
android:layout_weight="1" android:layout_width="fill_parent"></ListView>
</LinearLayout>
</LinearLayout>
I have a layout problem, the idea is that the buttons and text dont show
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#5094c5"
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingTop="8dp" >
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="#drawable/logo" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical" >
<ImageButton
android:id="#+id/buton_produse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"
android:src="#drawable/icon" />
<TextView
android:id="#+id/produse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Produse"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical" >
<ImageButton
android:id="#+id/buton_produse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="#drawable/icon" />
<TextView
android:id="#+id/produse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Produse"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical" >
<ImageButton
android:id="#+id/buton_produse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="#drawable/icon" />
<TextView
android:id="#+id/produse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Produse"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical" >
<ImageButton
android:id="#+id/buton_produse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="#drawable/icon" />
<TextView
android:id="#+id/produse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Produse"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Set the height and width in the xml layout file to what they should be when they are visible but initially, in code, get a reference to them and make them invisible. Then, when needed, you can make them visible (in code).
Maybe better try with RelativeLayout. This seems to be too nested and too much complicated than it suppose to be.
You can give setVisibility() property to button and textview in layout.
Can anybody tell me how to set a fixed header and footer for relative layout and center point? I want to add scrollable and adding array of webview dynamically when I want to scroll center point only scrollable in android. Can anybody give an example?
I tried but center part webview is not appearing properly, is there anything to change?
my xml code is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="#+id/mainrelativelayout" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="#+id/linear1" android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView android:paddingRight="75dip" android:paddingLeft="20dip" android:text="Index" android:id="#+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textStyle="bold"></TextView>
<TextView android:paddingRight="60dip" android:text="Last" android:id="#+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textStyle="bold"></TextView>
<TextView android:text="Change" android:id="#+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textStyle="bold"></TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="#+id/linear1" android:layout_height="6dip"
android:orientation="horizontal"
>
<ImageView android:id="#+id/ImageView08" android:layout_gravity="center" android:background="#drawable/line" android:layout_width="fill_parent" android:layout_height="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear2"
android:orientation="horizontal"
>
<ImageView android:id="#+id/ImageView05" android:paddingTop="5dip" android:layout_gravity="center" android:background="#drawable/down" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
<TextView android:paddingRight="30dip" android:paddingLeft="10dip" android:text="" android:id="#+id/txtindex0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textSize="12dip"></TextView>
<TextView android:paddingRight="55dip" android:text="" android:id="#+id/txtlast0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textSize="12dip"></TextView>
<TextView android:text="" android:id="#+id/txtchange0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12dip" android:textColor="#color/red1"></TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear3"
android:orientation="horizontal"
>
<ImageView android:id="#+id/ImageView02" android:layout_gravity="center" android:background="#drawable/up" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
<TextView android:paddingRight="46dip" android:paddingLeft="10dip" android:text="" android:id="#+id/txtindex1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textSize="12dip"></TextView>
<TextView android:paddingRight="64dip" android:text="" android:id="#+id/txtlast1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textSize="12dip"></TextView>
<TextView android:text="" android:id="#+id/txtchange1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12dip" android:textColor="#color/green1"></TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear4"
android:orientation="horizontal"
>
<ImageView android:id="#+id/ImageView03" android:layout_gravity="center" android:background="#drawable/up" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
<TextView android:paddingRight="69dip" android:paddingLeft="10dip" android:text="" android:id="#+id/txtindex2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textSize="12dip"></TextView>
<TextView android:paddingRight="67dip" android:text="" android:id="#+id/txtlast2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textSize="12dip"></TextView>
<TextView android:text="" android:id="#+id/txtchange2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12dip" android:textColor="#color/green1"></TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear4"
android:orientation="horizontal"
>
<ImageView android:id="#+id/ImageView04" android:layout_gravity="center" android:background="#drawable/up" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
<TextView android:paddingRight="61dip" android:paddingLeft="10dip" android:text="" android:id="#+id/txtindex3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textSize="12dip"></TextView>
<TextView android:paddingRight="65dip" android:text="" android:id="#+id/txtlast3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/black" android:textSize="12dip"></TextView>
<TextView android:text="" android:id="#+id/txtchange3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12dip" android:textColor="#color/green1"></TextView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="#+id/linear1" android:layout_height="4dip"
android:orientation="horizontal"
>
<ImageView android:id="#+id/ImageView08" android:layout_gravity="center" android:background="#drawable/line" android:layout_width="fill_parent" android:layout_height="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="15dip"
android:id="#+id/linear5"
android:orientation="horizontal"
>
<TextView android:text="Market data delayed at least 15 minutes " android:id="#+id/TextView16" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12dip" android:textColor="#color/gray2"></TextView>
</LinearLayout>
</LinearLayout>
<------ finishing header-------->
<---------- adding footer----------->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/imglinear"
android:background="#color/white"
android:layout_alignParentBottom="true"
>
<ImageView android:id="#+id/ImageView15" android:src="#drawable/quest_i" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
</LinearLayout>
<--------------finishing footer------->
<------------ center point of screen--------->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#color/white"
android:id="#+id/mainlinear3"
android:layout_above="#+id/imglinear"
android:layout_below="#+id/mainlinear2"
>
<ScrollView android:id="#+id/ScrollView01"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#color/white"
android:id="#+id/relative3">
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<-----------center point finishing---------->
</RelativeLayout>
thanks
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- HEADER -->
<include android:id="#+id/top_header"
android:layout_alignParentTop="true" layout="#layout/layout_header" />
<!-- FOOTER -->
<LinearLayout android:id="#+id/bottom_menu"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_alignParentBottom="true">
<!-- menu bar -->
<include layout="#layout/layout_footer_menu" />
</LinearLayout>
<!-- MAIN PART -->
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_below="#id/top_header" android:layout_above="#id/bottom_menu"
android:layout_weight="1"
android:id="#+id/sub_content_view"
android:paddingBottom="5sp" android:background="#EAEAEA">
</LinearLayout>
</RelativeLayout>
It is better to set to MAIN PART both:
android:layout_below="#id/top_header"
android:layout_above="#id/bottom_menu"
In your case content will be under the footer and scroll bar will be shown incorrect.
Also you need place footer in code above content - android want see ID's (#id/bottom_menu) if it wasn't define before.