I am using scroll view it has few toggle buttons in that.
When i click on any toggle button scroll view automatically scroll down by some considerable distance..
how can i avoid it??
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="#+id/ll_service_associate_container">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#color/dark_gray" android:textStyle="bold" android:layout_marginLeft="10dip" android:layout_marginTop="5dip" android:id="#+id/service_associate_title" android:text="#string/service_associate_title"></TextView>
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:background="#drawable/settinglist_background_filled_white" android:orientation="vertical" android:id="#+id/ll_service_associate_details" android:layout_marginTop="5dip">
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="#+id/ll_service_associate_cleanliness_main" android:layout_margin="5dip">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center_vertical" android:id="#+id/tv_associate_cleanliness_body" android:text="#string/service_associate_cleanliness" android:textColor="#color/black"></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:id="#+id/tv_service_associate_cleanliness_satisfaction" android:text="Very Satisfied" android:textColor="#color/navyBlue"></TextView>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#drawable/right" android:gravity="center_vertical" android:layout_gravity="center_vertical" android:id="#+id/btn_service_associate_cleanliness"></Button>
</LinearLayout>
<ImageView android:background="#color/dark_gray" android:layout_height="1dip" android:layout_width="fill_parent" android:id="#+id/iv_service_associate_cleanliness_divider"></ImageView>
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="#+id/ll_service_associate_skills_main" android:layout_margin="5dip">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center_vertical" android:id="#+id/tv_service_associate_skills_body" android:text="#string/service_associate_skills" android:textColor="#color/black"></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:id="#+id/tv_associate_skills_satisfaction" android:text="Very Satisfied" android:textColor="#color/navyBlue"></TextView>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#drawable/right" android:layout_gravity="center_vertical" android:id="#+id/btn_service_associate_skills"></Button>
</LinearLayout>
<ImageView android:background="#color/dark_gray" android:layout_height="1dip" android:layout_width="fill_parent" android:id="#+id/iv_service_associate_skills_divider"></ImageView>
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="#+id/ll_service_associate_information_main" android:layout_margin="5dip">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center_vertical" android:id="#+id/tv_service_associate_information_body" android:text="#string/service_associate_information" android:textColor="#color/black"></TextView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:id="#+id/tv_service_associate_information_satisfaction" android:text="Veri Satisfied" android:textColor="#color/navyBlue"></TextView>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#drawable/right" android:layout_gravity="center_vertical" android:id="#+id/btn_service_associate_information"></Button>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="#+id/ll_customer_comments_container" android:orientation="vertical">
<TextView android:id="#+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Customer Comments" android:layout_marginTop="5dip" android:layout_marginLeft="10dip" android:textColor="#color/dark_gray" android:textStyle="bold"></TextView>
<EditText android:background="#drawable/settinglist_background_filled_white" android:layout_height="fill_parent" android:minLines="4" android:layout_width="fill_parent" android:id="#+id/edt_customer_comments_body" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:layout_marginTop="5dip"></EditText>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent" android:id="#+id/ll_customer_survey_signature_container" android:layout_marginLeft="10dip" android:layout_marginTop="5dip" android:orientation="vertical" android:layout_marginRight="10dip" android:layout_height="wrap_content" android:layout_marginBottom="50dip">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="#+id/tv_customer_survey_signature_title" android:text="#string/customer_survey_signature_title" android:textColor="#color/dark_gray" android:textStyle="bold"></TextView>
<LinearLayout android:layout_width="fill_parent" android:id="#+id/ll_customer_survey_signature" android:background="#drawable/settinglist_background_filled_white" android:layout_marginTop="5dip" android:layout_height="150dip"></LinearLayout>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_marginTop="10dip" android:id="#+id/btn_clear_sign_customer_survey" android:text="#string/clear_sign" android:background="#drawable/top_bar_button" android:textColor="#color/white" android:layout_gravity="right"></Button>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Related
I am new to android development, I am building an app and on that I want to show Imageview and Textview side by side in android layout. Below code is showing textview below the imagview. Here I am using linearlayout.
In this layout I am showing some data from database.
Expected layout design:
Imageview Text1
Text2
Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.example.spand.krishnasoftwares.Main2Activity">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#color/colorBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="20px"
android:id="#+id/vly">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView"
android:src="#drawable/gym_logo1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/ly1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exercise 1"
android:textAlignment="center"
android:textAllCaps="true"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:textSize="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly1"
android:paddingLeft="5px"
android:paddingRight="5px"
android:id="#+id/ly2"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exercise Name:"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/en1"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly2"
android:id="#+id/ly3"
android:paddingLeft="5px"
android:paddingRight="5px"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Speed: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/es1"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly3"
android:paddingLeft="5px"
android:paddingRight="5px"
android:orientation="horizontal"
android:id="#+id/ly4">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Repetition: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:id="#+id/erep1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textColor="#ffffff"
android:textDirection="ltr" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/erep2"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/erep3"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly4"
android:paddingLeft="5px"
android:paddingRight="5px"
android:orientation="horizontal"
android:id="#+id/ly5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Weight: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:id="#+id/ew1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textColor="#ffffff"
android:textDirection="ltr" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Check this.. It will creates layout view hows you want.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/vly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="20px"
android:weightSum="3">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/add" />
<LinearLayout
android:id="#+id/ly"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:orientation="vertical">
<LinearLayout
android:id="#+id/ly1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20px"
android:text="Exercise 1"
android:textAlignment="center"
android:textAllCaps="true"
android:textSize="10dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/ly2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly1"
android:orientation="horizontal"
android:paddingLeft="5px"
android:paddingRight="5px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20px"
android:layout_weight="1"
android:text="Exercise Name:" />
<TextView
android:id="#+id/en1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20px"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="#+id/ly3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly2"
android:orientation="horizontal"
android:paddingLeft="5px"
android:paddingRight="5px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:text="Speed: " />
<TextView
android:id="#+id/es1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="#+id/ly4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly3"
android:orientation="horizontal"
android:paddingLeft="5px"
android:paddingRight="5px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:text="Repetition: " />
<TextView
android:id="#+id/erep1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textDirection="ltr" />
<TextView
android:id="#+id/erep2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textColor="#ffffff" />
<TextView
android:id="#+id/erep3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="#+id/ly5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly4"
android:orientation="horizontal"
android:paddingLeft="5px"
android:paddingRight="5px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:text="Weight: " />
<TextView
android:id="#+id/ew1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textDirection="ltr" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
why don't you use drawable left?
Use drawable left in first text-view and with proper padding between drawable and text you can easily achieve what you intend.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.example.spand.krishnasoftwares.Main2Activity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exercise 1"
android:textAlignment="center"
android:textAllCaps="true"
android:textColor="#ffffff"
android:drawableLeft="#drawable/"
android:layout_marginTop="20px"
android:textSize="10dp"/>
</android.support.constraint.ConstraintLayout>
BENEFITS:
You can save extra nesting of multiple view groups.
Lesser rendering time in case of recycler view or list view.
Recommended by Google developers resource.
you can't use ConstraintLayout in this way, follow the this code;
<LinearLayout
android:weightSum="2"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
Looks like #drawable/gym_logo1 is the child of #+id/vly LinearLayout that has android:orientation="vertical". You should try making it the child of #+id/ly1
Create your layout like this it'll work for you...but remind one thing search first if you don't get solution then ask...
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#color/colorBackground">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView"
android:src="#drawable/gym_logo1"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="20px"
android:layout_toRightOf="#+id/imageView"
android:id="#+id/vly">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/ly1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exercise 1"
android:textAlignment="center"
android:textAllCaps="true"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:textSize="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly1"
android:paddingLeft="5px"
android:paddingRight="5px"
android:id="#+id/ly2"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exercise Name:"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/en1"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly2"
android:id="#+id/ly3"
android:paddingLeft="5px"
android:paddingRight="5px"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Speed: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/es1"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly3"
android:paddingLeft="5px"
android:paddingRight="5px"
android:orientation="horizontal"
android:id="#+id/ly4">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Repetition: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:id="#+id/erep1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textColor="#ffffff"
android:textDirection="ltr" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/erep2"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/erep3"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ly4"
android:paddingLeft="5px"
android:paddingRight="5px"
android:orientation="horizontal"
android:id="#+id/ly5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Weight: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:id="#+id/ew1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textColor="#ffffff"
android:textDirection="ltr" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
Change your .xml to
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#color/colorBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="20px"
android:id="#+id/vly">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView"
android:src="#drawable/gym_logo1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/ly1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exercise 1"
android:textAlignment="center"
android:textAllCaps="true"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:textSize="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exercise Name:"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/en1"
android:textColor="#ffffff"
android:layout_marginTop="20px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Speed: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/es1"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Repetition: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:id="#+id/erep1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textColor="#ffffff"
android:textDirection="ltr" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/erep2"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/erep3"
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Weight: "
android:textColor="#ffffff"
android:layout_marginTop="10px"
android:layout_weight="1"/>
<TextView
android:id="#+id/ew1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_weight="1"
android:textColor="#ffffff"
android:textDirection="ltr" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
`
I hope the TextView controls which contain characters "A" have the same width with text align left and control align right , so I have set TextView controls which contain characters "A" with max width="150dp",
and I have set android:gravity="left" and android:layout_gravity="right"
I think I can get the result AA.png, but in fact the result is BB.png
I hope (AA.png)
Current (BB.png)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/border_ui"
android:orientation="vertical" >
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
android:layout_alignParentTop="true"
ads:adUnitId="#string/ad_unit_id" />
<LinearLayout
android:layout_above="#+id/linearLayout1"
android:layout_below="#+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_gravity="right"
android:layout_weight="0.5">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="A"
android:id="#+id/textView2"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="AAA"
android:id="#+id/textView4"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="AAAAA"
android:id="#+id/textView5"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="B"
android:id="#+id/textView3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="BBB"
android:id="#+id/textView6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="BBBB"
android:id="#+id/textView7"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:weightSum="4" >
<Button
android:id="#+id/btnReturn"
style="#style/myTextMedium"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:text="#string/BtnReturn" />
</LinearLayout>
</RelativeLayout>
You can accomplish that by adding an extra LinearLayout and removing the 150dp limitation:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
android:layout_alignParentTop="true"
ads:adUnitId="#string/ad_unit_id" />
<LinearLayout
android:layout_above="#+id/linearLayout1"
android:layout_below="#+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_weight="0.5">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="right">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="A"
android:id="#+id/textView2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="AAA"
android:id="#+id/textView4"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="AAAAA"
android:id="#+id/textView5"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="B"
android:id="#+id/textView3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="BBB"
android:id="#+id/textView6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="BBBB"
android:id="#+id/textView7"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:weightSum="4" >
<Button
android:id="#+id/btnReturn"
style="#style/myTextMedium"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:text="#string/BtnReturn" />
</LinearLayout>
i guess you will use
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_gravity="right"
android:layout_weight="0.5"
android:layoutMarginLeft="20dp">
android:layoutMarginLeft="20dp"
I would like show my Page view header like below,
I'm using the following layout using, but the image and second textview not moving to right, its all align center.
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="6"
android:background="#drawable/transbg"
android:gravity="center"
android:orientation="vertical" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="6"
android:gravity="center"
>
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Magasin"
android:textColor="#FFF"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:src="#drawable/yellow2" />
<TextView
android:id="#+id/tvCredits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="test"
android:textColor="#fff"
android:textSize="16sp" />
</LinearLayout>
</TableRow>
</LinearLayout>
</LinearLayout>
how I can align one image view and textview right aligned.
Check out this one and let me know if it is what you want.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="6"
android:background="#drawable/ic_launcher"
android:gravity="center"
android:orientation="vertical" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="6"
android:background="#android:color/black"
android:gravity="center" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Magasin"
android:textColor="#FFF"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:src="#drawable/ic_launcher"
android:layout_toLeftOf="#+id/tvCredits" />
<TextView
android:id="#+id/tvCredits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="test"
android:textColor="#fff"
android:textSize="16sp" />
</RelativeLayout>
</TableRow>
</LinearLayout>
EDIT : If you want to make the same layout with easier and more efficient way, you can use this one.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/black" >
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Magasin"
android:textColor="#FFF"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/tvCredits"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/tvCredits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="test"
android:textColor="#fff"
android:textSize="16sp" />
</RelativeLayout>
// try this way
<?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="wrap_content"
android:gravity="center"
android:padding="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/txtName"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Magasin"
android:textColor="#FFF"
android:gravity="center"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher"
android:adjustViewBounds="true"/>
<TextView
android:id="#+id/tvCredits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test"
android:textColor="#fff"
android:textSize="16sp"
android:layout_marginLeft="5dp"/>
</LinearLayout>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="right">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="6"
android:background="#drawable/transbg"
android:gravity="center"
android:orientation="vertical" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="6"
android:gravity="center"
>
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Magasin"
android:textColor="#FFF"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="right|center"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:src="#drawable/yellow2" />
<TextView
android:id="#+id/tvCredits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="test"
android:textColor="#fff"
android:textSize="16sp" />
</LinearLayout>
</TableRow>
</LinearLayout>
</LinearLayout>
</LinearLayout>
in Xml file i can not see button at bottom my code is here please help me
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#drawable/background">
<RelativeLayout android:layout_width="fill_parent"
android:background="#drawable/navigationbar" android:layout_below="#+id/top"
android:id="#+id/toptext" android:layout_height="50dip">
<Button android:layout_width="wrap_content" android:background="#drawable/back"
android:textStyle="bold" android:layout_height="wrap_content"
android:paddingLeft="10dip" android:layout_margin="10dip" android:id="#+id/back"
android:layout_alignParentLeft="true"></Button>
<TextView android:layout_width="wrap_content" android:text="#string/source_of_stress"
android:textSize="20dip" android:layout_marginLeft="100dip"
android:layout_marginTop="8dip" android:layout_height="wrap_content"
android:textColor="#FFFFFF" android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout android:orientation="horizontal"
android:id="#+id/date" android:layout_below="#+id/toptext"
android:gravity="center" android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:id="#+id/previous" android:background="#drawable/left_arrow"
android:visibility="gone" android:layout_marginTop="15dip"
android:layout_marginLeft="10dip" android:layout_alignParentLeft="true"
android:layout_width="20dip" android:layout_height="23dip"
android:textColor="#FFFFFFFF" />
<RelativeLayout android:layout_width="fill_parent"
android:background="#drawable/datebar"
android:layout_centerHorizontal="true" android:layout_height="wrap_content"
android:paddingLeft="10dip" android:paddingRight="10dip">
<TextView android:id="#+id/currentDate" android:textSize="19sp"
android:layout_centerHorizontal="true" android:layout_marginTop="10dip"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#2972cc" android:text="Monday" android:textStyle="bold" />
<Button android:id="#+id/next" android:background="#drawable/right_arrow"
android:visibility="gone" android:layout_marginTop="15dip"
android:layout_marginRight="10dip" android:layout_alignParentRight="true"
android:layout_width="20dip" android:layout_height="23dip"
android:textColor="#FFFFFFFF" />
</RelativeLayout>
</RelativeLayout>
<!--
<TextView android:layout_width="wrap_content"
android:visibility="gone" android:textSize="11sp"
android:layout_marginLeft="8dip" android:layout_below="#+id/date"
android:id="#+id/all_sos_text" android:layout_marginTop="5dip"
android:layout_height="wrap_content"></TextView> <ScrollView
android:id="#+id/list_scroll" android:layout_marginBottom="55dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/date"
android:layout_marginTop="5dip" android:fadingEdge="none"
android:scrollbars="none">
-->
<ScrollView android:id="#+id/sos_scroll"
android:layout_marginBottom="82dip" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/date"
android:layout_marginTop="5dip" android:fadingEdge="none"
android:scrollbars="none">
<LinearLayout android:layout_width="fill_parent"
android:id="#+id/sos_lin" android:layout_height="wrap_content"
android:orientation="vertical">
<ListView android:paddingLeft="1dip" android:scrollbars="none"
android:cacheColorHint="#00000000" android:focusable="true"
android:id="#+id/list" android:dividerHeight="2dip"
android:footerDividersEnabled="false" android:headerDividersEnabled="false"
android:layout_marginRight="12dip" android:listSelector="#android:color/transparent"
android:background="#drawable/newshape_list"
android:layout_marginLeft="12dip" android:paddingRight="1dip"
android:layout_height="230dip" android:layout_width="fill_parent"
android:fadingEdge="none" android:divider="#A9ABAD"></ListView>
<RelativeLayout android:layout_width="wrap_content"
android:layout_marginLeft="10dip" android:layout_marginBottom="50dip"
android:layout_marginRight="10dip" android:layout_height="wrap_content"
android:layout_below="#+id/list">
<TableLayout android:layout_width="wrap_content"
android:id="#+id/add_table" android:layout_centerHorizontal="true"
android:background="#drawable/listback" android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow android:id="#+id/add_data">
<ImageView android:layout_width="wrap_content"
android:src="#drawable/addbuttonimage" android:id="#+id/que1"
android:layout_height="wrap_content"></ImageView>
<TextView android:text="Add New Stress..."
android:layout_width="wrap_content" android:textStyle="bold"
android:textColor="#000000" android:layout_marginLeft="5dip"
android:textSize="15sp" android:layout_height="wrap_content"
android:padding="3dip" />
</TableRow>
</TableLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_below="#+id/sos_scroll" android:id="#+id/donerel"
android:layout_marginTop="5dip" android:layout_centerHorizontal="true">
<Button android:textColor="#FFFFFF" android:text="Save"
android:layout_width="wrap_content" android:textStyle="bold"
android:background="#drawable/savebutton" android:layout_height="wrap_content"
android:id="#+id/done"></Button>
</RelativeLayout>
The reason that the layout is not showing is layout_marginBottom="82dip" on the ScrollView
So changing:
<ScrollView android:id="#+id/sos_scroll"
android:layout_marginBottom="82dip" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/date"
android:layout_marginTop="5dip" android:fadingEdge="none"
android:scrollbars="none">
to for example:
<ScrollView android:id="#+id/sos_scroll"
android:layout_marginBottom="1dip" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/date"
android:layout_marginTop="5dip" android:fadingEdge="none"
android:scrollbars="none">
should help.
I am creating fixed header and fixed footer for RelativeLayout. In the center part I am adding array of WebView when it come ScrollView it hide header and footer.
How can I avoid that?
This is my layout file:
<?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:layout_height="wrap_content"
android:background="#color/white"
android:id="#+id/mainlinear2"
android:layout_alignParentTop="true"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="15dip"
android:orientation="horizontal"
android:id="#+id/linear5">
<TextView android:text=" "
android:id="#+id/txtwebservice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12dip"
android:textColor="#color/gray2"></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 mlns: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>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear8"
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>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="200dip"
android:background="#color/white"
android:id="#+id/mainlinear3"
android:layout_above="#+id/linear8"
android:layout_below="#+id/mainlinear2"
android:layout_weight="1">
</LinearLayout>
</RelativeLayout>
<!--</ScrollView>-->
why you are making it a single view....
Attach two imageView header and footer to the scrollview .
|ImageView| |/ImageView|
|ScrollView| |/ScrollView|
|ImageView| |/ImageView|