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>
`
Related
image `
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="top"
android:orientation="vertical">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:gravity="left"
android:text="Satisfied"
android:textSize="15dp"
android:textStyle="normal" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<com.example.rupertfernandes.itsforyou.progressutil.ProgressIndicator
android:id="#+id/determinate_progress_indicator1"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginLeft="30dp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="150dp"
android:gravity="center"
android:text="Satisfied"
android:textColor="#7CFC00"
android:textSize="25dp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_margin="10dp"
android:background="#ffffff" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="#+id/questiontext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="10dp"
android:text="Question of the Day"
android:textColor="#7CFC00"
android:textSize="20dp" />
<TextView
android:id="#+id/questiontextOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="10dip"
android:text="Q-1. How are you feeling today ?"
android:textColor="#ff69b4"
android:textSize="15dp" />
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
<include
android:id="#+id/cell1"
layout="#layout/radiobutton"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="#+id/questiontextTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="10dip"
android:text="Q-3. How is the day going on ?"
android:textColor="#ff69b4"
android:textSize="15dp" />
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
<include
android:id="#+id/cell1"
layout="#layout/radiobutton"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="#+id/questiontextThree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="10dip"
android:text="Q-4. How is the work going on ?"
android:textColor="#ff69b4"
android:textSize="15dp" />
<LinearLayout
android:id="#+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
<include
android:id="#+id/cell1"
layout="#layout/radiobutton"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="#+id/questiontextFour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="10dip"
android:text="Q-5. How is the night going on ?"
android:textColor="#ff69b4"
android:textSize="15dp" />
<LinearLayout
android:id="#+id/linearLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
<include
android:id="#+id/cell1"
layout="#layout/radiobutton"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:id="#+id/btnsubmitwellbeing"
android:layout_width="fill_parent"
android:background="#7CFC00"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Submit"
android:textAllCaps="false"
android:textColor="#ffffff"
android:textSize="25dp"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
below is the include 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="wrap_content"
android:gravity="center"
android:padding="3dp"
android:weightSum="1" >
<RadioGroup
android:id="#+id/radioGroupWell"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/extremely_unsatisfied"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:button="#null"
android:gravity="center"
android:onClick="extremely_unsatisfied"
android:text="Extremely Unsatisfied"
android:drawableTop="#drawable/user_icon"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000" >
</RadioButton>
<RadioButton
android:id="#+id/unsatisfied"
android:layout_width="0dp"
android:button="#null"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:drawableTop="#drawable/user_icon"
android:gravity="center"
android:onClick="unsatisfied"
android:text="Unsatisfied"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000" >
</RadioButton>
<RadioButton
android:id="#+id/neutral"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:button="#null"
android:drawableTop="#drawable/user_icon"
android:gravity="center"
android:text="Neutral"
android:onClick="neutral"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000" >
</RadioButton>
<RadioButton
android:id="#+id/satisfied"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:drawableTop="#drawable/user_icon"
android:gravity="center"
android:button="#null"
android:onClick="satisfied"
android:text="Satisfied"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000" >
</RadioButton>
<RadioButton
android:id="#+id/extremly_satisfied"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:drawableTop="#drawable/user_icon"
android:gravity="center"
android:onClick="extremly unsatisfied"
android:text="Extremely Satisfied"
android:button="#null"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000" >
</RadioButton>
</RadioGroup>
</LinearLayout>
`I have attached a file.
It has 5 radiobuttons in one row..and there are 5 such rows..the radiobuttons are inside a scroll view.
kindly help with xml file and the code as to how to check the radio buttons and also on click of submit the value in the circular progress bar should increase based on the user input in the radio buttonsthe image is as shown
You can't attach files here.
RadioButtons have an OnCheckChangedLister that does what you'd expect. Or you can call isChecked() to poll the value.
<?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="wrap_content"
android:orientation="horizontal"
android:id="#+id/linhaCliente"
android:clickable="false"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="5dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:background="#drawable/pedidos_shape"
android:layout_height="wrap_content"
android:clickable="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="5dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:layout_weight="0.28">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numeroPedido"
android:text="123456 "
android:textStyle="bold"
android:textSize="20dp"
android:textColor="#color/pedidos_cinza"
android:layout_marginRight="5dp"
android:paddingLeft="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/pedidoID"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|right"
android:columnCount="2"
android:layout_weight="0.28"
android:paddingRight="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="19/10/2014 às 14:30"
android:id="#+id/data_criado"
android:textStyle="bold"
android:textColor="#color/pedidos_cinza"
android:textSize="15dp"
android:textIsSelectable="false"
android:editable="false"
android:focusable="false"
android:layout_marginTop="3dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:layout_weight="0.20"
android:paddingRight="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R$ 16.450,00 "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/valorPedido"
android:paddingLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(Condição: "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicao" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2x "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicaoPedido" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/ViewEndereco"
android:layout_height="8dip"
android:layout_width="match_parent"
android:background="#drawable/dot"
android:layerType="software"
android:orientation="horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/statusPedido"
android:text="Status"
android:textColor="#color/pedidos_cinza"
android:textStyle="bold"
android:textSize="20dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:padding="10dp" />
</LinearLayout>
</LinearLayout>
The above xml code gives me that result:
I need to add an arrow like the following image:
The problem is that I can't get that arrow to be aligned as it was suppose to be, either I put it aligned with the date or with the price, but I need it to be independent, exactly like the image above.
I manage that doing this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:id="#+id/linhaCliente"
android:clickable="false">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#drawable/pedidos_shape"
android:orientation="vertical"
android:id="#+id/linearLayout8"
android:layout_margin="10dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout9">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numeroPedido"
android:text="123456 "
android:textStyle="bold"
android:textSize="20dp"
android:textColor="#color/pedidos_cinza"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingBottom="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="19/10/2014 às 14:30"
android:id="#+id/data_criado"
android:textStyle="bold"
android:textColor="#color/pedidos_cinza"
android:textSize="15dp"
android:gravity="right" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/pedidoID"
android:visibility="gone" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout10" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R$ 16.450,00 "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/valorPedido"
android:paddingLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(Condição: "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicao" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2x "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicaoPedido" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/phone"
android:layout_width="48dp"
android:layout_height="48dp"
android:clickable="true"
android:src="#drawable/ic_action_name"
android:background="?attr/selectableItemBackground"
/>
</LinearLayout>
<View
android:id="#+id/ViewEndereco"
android:layout_height="8dip"
android:layout_width="match_parent"
android:background="#drawable/dot"
android:layerType="software"
android:orientation="horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/statusPedido"
android:text="Status"
android:textColor="#color/pedidos_cinza"
android:textStyle="bold"
android:textSize="20dp"
android:padding="10dp" />
</LinearLayout>
</LinearLayout>
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>
I'm trying to do my own listView with the xml file, this is what I would like to get:
And this is what I get:
And my xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
>
<ImageButton android:id="#+id/parkingState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginRight="4dip"
android:layout_marginLeft="4dip"
android:background="#null"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
>
<TextView android:id="#+id/LblTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="14dip" />
<TextView android:id="#+id/LblSubTitle"
android:layout_marginLeft="12dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="normal"
android:textColor="#444444"
android:textSize="12px" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
>
<ImageButton android:id="#+id/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginRight="4dip"
android:layout_marginLeft="4dip"
android:background="#null"/>
<ImageButton android:id="#+id/rent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginRight="4dip"
android:layout_marginLeft="4dip"
android:background="#null"/>
</LinearLayout>
How can I get the first image?
Try to change your text linearLayout like this
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
Final:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
>
<ImageButton android:id="#+id/parkingState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginRight="4dip"
android:layout_marginLeft="4dip"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
<TextView android:id="#+id/LblTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="14dip"/>
<TextView android:id="#+id/LblSubTitle"
android:layout_marginLeft="12dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="normal"
android:textColor="#444444"
android:textSize="12px"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
>
<ImageButton android:id="#+id/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginRight="4dip"
android:layout_marginLeft="4dip"/>
<ImageButton android:id="#+id/rent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginRight="4dip"
android:layout_marginLeft="4dip"/>
</LinearLayout>
</LinearLayout>
Hope this will help you.
The LinearLayout that contains #+id/LblTitle and #+id/LblSubTitle should look like this
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
So it will take all the remaining width and will not overlap your pictures
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|