ScrollView changes size of widgets android - android

Hi guys i am having this xml file with a scroll view.This works fine in the layout editor but when i run it in the android emulator the size and scaling of widget changes.I used same scrren size for both the layout editor and the emulator.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="867dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Arizona State University"
android:id="#+id/textView41"
android:layout_alignTop="#+id/view2"
android:layout_alignParentEnd="true"
android:layout_toEndOf="#+id/view2"
android:textSize="18sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Tution:19,273$"
android:id="#+id/textView42"
android:layout_below="#+id/textView41"
android:layout_marginTop="20sp"
android:layout_alignStart="#+id/textView41" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Your GPA is 3.5% higher"
android:id="#+id/textView51"
android:layout_above="#+id/textView52"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/imageView5"
android:layout_toEndOf="#+id/imageView5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView52"
android:layout_below="#+id/view2"
android:layout_alignParentEnd="true"
android:layout_above="#+id/textView53"
android:layout_alignStart="#+id/textView51" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Your GRE verbal is 2.1% higher"
android:id="#+id/textView53"
android:layout_marginTop="20dp"
android:layout_below="#+id/view2"
android:layout_alignStart="#+id/textView52"
android:layout_alignEnd="#+id/textView52" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView5"
android:src="#drawable/tic"
android:layout_above="#+id/textView52"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView6"
android:layout_alignTop="#+id/textView53"
android:layout_alignStart="#+id/imageView5"
android:src="#drawable/tic"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Your GRE Quants is 1.1% higher"
android:id="#+id/textView47"
android:layout_below="#+id/textView53"
android:layout_marginTop="20sp"
android:layout_alignStart="#+id/textView53"
android:layout_alignEnd="#+id/textView53" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView4"
android:layout_alignTop="#+id/textView47"
android:layout_toStartOf="#+id/textView47"
android:src="#drawable/tic"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Specifications"
android:id="#+id/textView48"
android:layout_below="#+id/textView47"
android:layout_marginTop="54dp"
android:layout_alignStart="#+id/view2"
android:layout_toStartOf="#+id/textView47" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="https://parttime.com"
android:id="#+id/textView49"
android:layout_alignBottom="#+id/imageView7"
android:layout_alignStart="#+id/textView42"
android:layout_alignTop="#+id/imageView7"
android:textSize="21sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Neural Networks"
android:id="#+id/textView50"
android:layout_marginTop="20sp"
android:layout_below="#+id/textView49"
android:layout_alignStart="#+id/textView49"
android:textSize="21sp"/>
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Databases"
android:id="#+id/textView54"
android:layout_marginTop="20sp"
android:layout_below="#+id/imageView8"
android:layout_alignStart="#+id/textView50"
android:textSize="21sp"/>
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView7"
android:src="#drawable/bullet_grey"
android:layout_below="#+id/textView48"
android:layout_alignStart="#+id/imageView8"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView8"
android:src="#drawable/bullet_grey"
android:layout_alignTop="#+id/textView50"
android:layout_toStartOf="#+id/textView54" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView9"
android:layout_alignTop="#+id/textView54"
android:layout_alignEnd="#+id/imageView8"
android:src="#drawable/bullet_grey"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Computer Architecture"
android:id="#+id/textView55"
android:layout_below="#+id/textView54"
android:layout_marginTop="20sp"
android:layout_alignStart="#+id/textView54"
android:textSize="21sp"/>
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView10"
android:src="#drawable/bullet_grey"
android:layout_alignTop="#+id/textView55"
android:layout_toStartOf="#+id/textView55" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Theory"
android:id="#+id/textView56"
android:layout_below="#+id/imageView10"
android:layout_alignStart="#+id/textView55"
android:layout_marginTop="20sp"
android:textSize="21sp"/>
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView11"
android:layout_alignTop="#+id/textView56"
android:layout_toStartOf="#+id/textView56"
android:src="#drawable/bullet_grey"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Part time jobs"
android:id="#+id/textView57"
android:layout_below="#+id/imageView11"
android:layout_alignEnd="#+id/textView48"
android:layout_marginTop="41dp"
android:layout_alignStart="#+id/textView48" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="https://parttime.com"
android:id="#+id/textView58"
android:layout_marginTop="39dp"
android:layout_below="#+id/textView57"
android:layout_alignStart="#+id/textView56"
android:layout_alignEnd="#+id/textView55"
android:textColor="#android:color/darker_gray"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView12"
android:layout_alignBottom="#+id/textView58"
android:layout_alignStart="#+id/imageView11"
android:layout_toStartOf="#+id/imageView4"
android:layout_alignEnd="#+id/imageView11"
android:layout_alignTop="#+id/textView58"
android:src="#drawable/bullet_grey"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Admissions"
android:id="#+id/textView59"
android:layout_marginTop="47dp"
android:layout_below="#+id/textView58"
android:layout_alignStart="#+id/textView57" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="https://parttime.com"
android:id="#+id/textView60"
android:textColor="#android:color/darker_gray"
android:layout_below="#+id/textView59"
android:layout_alignEnd="#+id/textView49" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView13"
android:layout_alignStart="#+id/imageView12"
android:layout_alignTop="#+id/textView60"
android:layout_alignEnd="#+id/imageView12"
android:layout_alignBottom="#+id/textView60"
android:src="#drawable/bullet_grey"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Research lab links"
android:id="#+id/textView61"
android:layout_alignParentBottom="true"
android:layout_toStartOf="#+id/textView47"
android:layout_gravity="right" />
</RelativeLayout>
</LinearLayout>
</ScrollView>

The scrollview doesn't have a size to relay on
it is best to put a LinearLayout parent for the scrollview
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="867dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView41"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/view2"
android:layout_toEndOf="#+id/view2"
android:text="Arizona State University"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="18sp" />
<TextView
android:id="#+id/textView42"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView41"
android:layout_below="#+id/textView41"
android:layout_marginTop="20sp"
android:text="Tution:19,273$"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView51"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView52"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/imageView5"
android:layout_toEndOf="#+id/imageView5"
android:text="Your GPA is 3.5% higher"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView52"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView53"
android:layout_alignParentEnd="true"
android:layout_alignStart="#+id/textView51"
android:layout_below="#+id/view2"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView53"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView52"
android:layout_alignStart="#+id/textView52"
android:layout_below="#+id/view2"
android:layout_marginTop="20dp"
android:text="Your GRE verbal is 2.1% higher"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView52"
android:layout_centerHorizontal="true"
android:src="#drawable/tic" />
<ImageView
android:id="#+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/imageView5"
android:layout_alignTop="#+id/textView53"
android:src="#drawable/tic" />
<TextView
android:id="#+id/textView47"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView53"
android:layout_alignStart="#+id/textView53"
android:layout_below="#+id/textView53"
android:layout_marginTop="20sp"
android:text="Your GRE Quants is 1.1% higher"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView47"
android:layout_toStartOf="#+id/textView47"
android:src="#drawable/tic" />
<TextView
android:id="#+id/textView48"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/view2"
android:layout_below="#+id/textView47"
android:layout_marginTop="54dp"
android:layout_toStartOf="#+id/textView47"
android:text="Specifications"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView49"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView7"
android:layout_alignStart="#+id/textView42"
android:layout_alignTop="#+id/imageView7"
android:text="https://parttime.com"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="21sp" />
<TextView
android:id="#+id/textView50"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView49"
android:layout_below="#+id/textView49"
android:layout_marginTop="20sp"
android:text="Neural Networks"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="21sp" />
/>
<TextView
android:id="#+id/textView54"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView50"
android:layout_below="#+id/imageView8"
android:layout_marginTop="20sp"
android:text="Databases"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="21sp" />
/>
<ImageView
android:id="#+id/imageView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/imageView8"
android:layout_below="#+id/textView48"
android:src="#drawable/bullet_grey" />
<ImageView
android:id="#+id/imageView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView50"
android:layout_toStartOf="#+id/textView54"
android:src="#drawable/bullet_grey" />
<ImageView
android:id="#+id/imageView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/imageView8"
android:layout_alignTop="#+id/textView54"
android:src="#drawable/bullet_grey" />
<TextView
android:id="#+id/textView55"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView54"
android:layout_below="#+id/textView54"
android:layout_marginTop="20sp"
android:text="Computer Architecture"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="21sp" />
/>
<ImageView
android:id="#+id/imageView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView55"
android:layout_toStartOf="#+id/textView55"
android:src="#drawable/bullet_grey" />
<TextView
android:id="#+id/textView56"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView55"
android:layout_below="#+id/imageView10"
android:layout_marginTop="20sp"
android:text="Theory"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="21sp" />
/>
<ImageView
android:id="#+id/imageView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView56"
android:layout_toStartOf="#+id/textView56"
android:src="#drawable/bullet_grey" />
<TextView
android:id="#+id/textView57"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView48"
android:layout_alignStart="#+id/textView48"
android:layout_below="#+id/imageView11"
android:layout_marginTop="41dp"
android:text="Part time jobs"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView58"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView55"
android:layout_alignStart="#+id/textView56"
android:layout_below="#+id/textView57"
android:layout_marginTop="39dp"
android:text="https://parttime.com"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/darker_gray" />
<ImageView
android:id="#+id/imageView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView58"
android:layout_alignEnd="#+id/imageView11"
android:layout_alignStart="#+id/imageView11"
android:layout_alignTop="#+id/textView58"
android:layout_toStartOf="#+id/imageView4"
android:src="#drawable/bullet_grey" />
<TextView
android:id="#+id/textView59"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView57"
android:layout_below="#+id/textView58"
android:layout_marginTop="47dp"
android:text="Admissions"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView60"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView49"
android:layout_below="#+id/textView59"
android:text="https://parttime.com"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/darker_gray" />
<ImageView
android:id="#+id/imageView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView60"
android:layout_alignEnd="#+id/imageView12"
android:layout_alignStart="#+id/imageView12"
android:layout_alignTop="#+id/textView60"
android:src="#drawable/bullet_grey" />
<TextView
android:id="#+id/textView61"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="right"
android:layout_toStartOf="#+id/textView47"
android:text="Research lab links"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

Related

How to make listview work correctly in my app

I have this Food Diary layout. Under the Add Food Button for each of the Breakfast, Lunch and Dinner Headings. A listview should appear with a list of food items added in it. Initially it will be empty so it should appear with the food items when something gets added in it.
I've written the xml for the layout but I haven't been able to successfully set the listview in it
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="20"
tools:context="hamza.example.fitkitapp.Food_Diary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorBlueTopBar"
android:text="#string/FoodDiary"
android:textColor="#color/colorWhiteTopBarText"
android:textSize="#dimen/topBarText" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="35dp"
android:text="Today"
android:gravity="center"
android:id="#+id/textView"
android:textColor="#color/colorWhiteTopBarText"
android:textSize="19sp"
android:background="#color/colorgray"
android:layout_weight="0.04" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="22dp">
<TextView
android:layout_width="50dp"
android:layout_height="21dp"
android:text="2,230"
android:textSize="19dp"
android:layout_marginLeft="10dp"
android:textColor="#color/colorBlack"
android:id="#+id/textView2"
android:layout_weight="0.04" />
<TextView
android:layout_width="15dp"
android:layout_height="21dp"
android:text="-"
android:textSize="19sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView101"
android:layout_marginLeft="30dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="40dp"
android:layout_height="21dp"
android:text="8"
android:textSize="19sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView100"
android:layout_marginLeft="30dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="40dp"
android:layout_height="21dp"
android:text="="
android:textSize="19sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView102"
android:layout_marginLeft="20dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="50dp"
android:layout_height="21dp"
android:text="1,230"
android:textSize="19sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView105"
android:layout_marginLeft="30dp"
android:layout_weight="0.04" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="50dp"
android:layout_height="21dp"
android:text="Goal"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView106"
android:layout_marginLeft="30dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="50dp"
android:layout_height="21dp"
android:text="Food"
android:textSize="15sp
android:textColor="#color/colorBlack"
android:id="#+id/textView107"
android:layout_marginLeft="70dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="80dp"
android:layout_height="21dp"
android:text="Remaining"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView108"
android:layout_marginLeft="75dp"
android:layout_weight="0.04" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="360dp"
android:layout_height="20dp"
android:background="#color/colorDarkBlue"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="110dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Calories"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="175dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Carbs"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="225dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Fat"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="255dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Protein"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="310dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Sugars"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="360dp"
android:layout_height="20dp">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="360dp"
android:layout_height="20dp"
android:background="#color/colorDarkBlue"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="125dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="kcal"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="185dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="g"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="232dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="g"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="275dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="g"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="325dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="g"
/>
</FrameLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="32dp"
android:text="Breakfast"
android:id="#+id/textView3"
android:textSize="19dp"
android:gravity="start|center"
android:textColor="#color/colorWhiteTopBarText"
android:background="#color/colorBlueTopBar"
android:layout_weight="0.05" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/add"
android:layout_marginTop="5dp"
android:id="#+id/addFood1"
android:layout_marginLeft="4dp"
android:layout_marginBottom="-250dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="30dp"
android:text=" Add Food"
android:layout_marginTop="7dp"
android:id="#+id/textView4"
android:textColor="#color/colorBlueTopBar"
android:textSize="19dp" />
</LinearLayout>
<ListView
android:id="#+id/listviewBreakfast"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="100dp">
</ListView>
<TextView
android:layout_width="match_parent"
android:layout_height="32dp"
android:text="Lunch"
android:id="#+id/lunch"
android:textSize="19dp"
android:gravity="start|center"
android:textColor="#color/colorWhiteTopBarText"
android:background="#color/colorBlueTopBar"
android:layout_weight="0.05" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/add"
android:id="#+id/addFood2"
android:layout_marginTop="5dp"
android:layout_marginLeft="4dp"
android:layout_marginBottom="-250dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="30dp"
android:text=" Add Food"
android:id="#+id/add_lunch"
android:layout_marginTop="7dp"
android:textColor="#color/colorBlueTopBar"
android:textSize="19dp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="32dp"
android:text="Dinner"
android:gravity="start|center"
android:id="#+id/dinner"
android:textSize="19dp"
android:textColor="#color/colorWhiteTopBarText"
android:background="#color/colorBlueTopBar"
android:layout_weight="0.05" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/add"
android:layout_marginTop="5dp"
android:id="#+id/addFood3"
android:layout_marginLeft="4dp"
android:layout_marginBottom="-250dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="30dp"
android:text=" Add Food"
android:id="#+id/add_dinner"
android:layout_marginTop="7dp"
android:textColor="#color/colorBlueTopBar"
android:textSize="19dp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="32dp"
android:text="Totals"
android:id="#+id/total"
android:textSize="19dp"
android:gravity="start|center"
android:textColor="#color/colorWhiteTopBarText"
android:background="#color/colorBlueTopBar"
android:layout_weight="0.05" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="35dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Goals"
android:textColor="#color/colorBlack"
android:textSize="19dp"
android:id="#+id/textView5"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2,230"
android:layout_marginLeft="75dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1011"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="278"
android:layout_marginLeft="25dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1012"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="74"
android:layout_marginLeft="25dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1013"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="111"
android:layout_marginLeft="25dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1014"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2,300"
android:layout_marginLeft="10dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1015"
android:layout_weight="0.24" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/divider"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="35dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Remaining"
android:textSize="19dp"
android:textColor="#color/colorBlack"
android:id="#+id/textView6"
android:layout_weight="0.19" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2,230"
android:layout_marginLeft="35dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView1041"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="278"
android:layout_marginLeft="25dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView1042"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="74"
android:layout_marginLeft="25dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView101443"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="111"
android:layout_marginLeft="25dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView10444"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2,300"
android:layout_marginLeft="10dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView10435"
android:layout_weight="0.24" />
</LinearLayout>
<Button
android:layout_width="123dp"
android:layout_height="40dp"
android:text="Make Entry"
android:layout_marginBottom="-20dp"
android:background="#color/colorgray"
android:layout_gravity="center"
android:id="#+id/Btn_MakeEntry"
android:textColor="#color/colorWhiteTopBarText"
android:textSize="17dp"
android:layout_weight="0.10" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#drawable/bottom_bar"
android:layout_marginTop="40dp"
>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_gravity="bottom"
android:text="#string/Home"
android:id="#+id/Btn_Home1"
android:background="#color/colorBlueTopBar"
android:textColor="#color/colorWhiteTopBarText"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="130dp"
android:layout_marginTop="7dp"
android:text="#string/FoodDiary"
android:id="#+id/Btn_FD1"
android:background="#color/colorBlueTopBar"
android:textColor="#color/colorWhiteTopBarText"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="7dp"
android:layout_marginLeft="270dp"
android:layout_marginRight="2dp"
android:text="#string/Progress"
android:id="#+id/Btn_Progress1"
android:background="#color/colorBlueTopBar"
android:textColor="#color/colorWhiteTopBarText"
/>
</FrameLayout>
</LinearLayout>
</RelativeLayout>
Is it somehow possible to let it grow and not affect the Lunch textview below it?
[Update 1]
I tried with the expandable listview. Made three of them under the Breakfast,Lunch and Dinner Headings. I haven't been successful with them also.
You can't not affect all the stuff below. I suggest placing it in a listview though, so that the user can scroll through.
Use expandable listview where addfood will be parent and add fooditems as its child view. You will have to use three different listviews for three categories.

android activity does not scroll down

I m using android studio 1.0.... In design ,my screen is get filled and when it runs it needs to scroll down but its not ... I tried previous answers an add scroll view in layout but there is error ( Scroll view can host only one child) enter code here
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/ScrollView">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="INTRODUCTION:"
android:id="#+id/heading1"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAlignment="center"
android:phoneNumber="false"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/Introduction"
android:id="#+id/textView2"
android:layout_below="#+id/heading1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="HYDROCARBON:"
android:id="#+id/textView3"
android:layout_below="#+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/hydrocarbon"
android:id="#+id/textView4"
android:layout_below="#+id/textView3"
android:layout_alignLeft="#+id/textView2"
android:layout_alignStart="#+id/textView2" />
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:id="#+id/imageView"
android:layout_below="#+id/textView4"
android:layout_centerHorizontal="true"
android:src="#drawable/ethane"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="TYPES OF HYDROCARBON:"
android:id="#+id/textView5"
android:layout_below="#+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/types"
android:id="#+id/textView6"
android:layout_below="#+id/textView5"
android:layout_alignLeft="#+id/textView4"
android:layout_alignStart="#+id/textView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkane"
android:id="#+id/textView7"
android:layout_below="#+id/textView6"
android:layout_alignLeft="#+id/textView6"
android:layout_alignStart="#+id/textView6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkene"
android:id="#+id/textView8"
android:layout_below="#+id/textView7"
android:layout_alignLeft="#+id/textView7"
android:layout_alignStart="#+id/textView7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkyne"
android:id="#+id/textView9"
android:layout_below="#+id/textView8"
android:layout_alignLeft="#+id/textView8"
android:layout_alignStart="#+id/textView8" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BACK"
android:id="#+id/button2"
android:onClick="mainPage"
android:layout_below="#+id/textView9"
android:layout_alignRight="#+id/textView8"
android:layout_alignEnd="#+id/textView8" />
This should help
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/ScrollView">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/RelativeLayout">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="INTRODUCTION:"
android:id="#+id/heading1"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textAlignment="center"
android:phoneNumber="false"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/Introduction"
android:id="#+id/textView2"
android:layout_below="#+id/heading1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="HYDROCARBON:"
android:id="#+id/textView3"
android:layout_below="#+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/hydrocarbon"
android:id="#+id/textView4"
android:layout_below="#+id/textView3"
android:layout_alignLeft="#+id/textView2"
android:layout_alignStart="#+id/textView2" />
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:id="#+id/imageView"
android:layout_below="#+id/textView4"
android:layout_centerHorizontal="true"
android:src="#drawable/ethane" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="TYPES OF HYDROCARBON:"
android:id="#+id/textView5"
android:layout_below="#+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/types"
android:id="#+id/textView6"
android:layout_below="#+id/textView5"
android:layout_alignLeft="#+id/textView4"
android:layout_alignStart="#+id/textView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkane"
android:id="#+id/textView7"
android:layout_below="#+id/textView6"
android:layout_alignLeft="#+id/textView6"
android:layout_alignStart="#+id/textView6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkene"
android:id="#+id/textView8"
android:layout_below="#+id/textView7"
android:layout_alignLeft="#+id/textView7"
android:layout_alignStart="#+id/textView7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Alkyne"
android:id="#+id/textView9"
android:layout_below="#+id/textView8"
android:layout_alignLeft="#+id/textView8"
android:layout_alignStart="#+id/textView8" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BACK"
android:id="#+id/button2"
android:onClick="mainPage"
android:layout_below="#+id/textView9"
android:layout_alignRight="#+id/textView8"
android:layout_alignEnd="#+id/textView8" />
</RelativeLayout>
</ScrollView>
Scroll view tag can have only one child element
Put your content of scroll view in linear layout.
<ScrollView>
<LinearLayout>
.......
.......
.....
</LinearLayout>
</ScrollView>

How to use scroll view in relative layout which exist in fragment?

i am stuck how to scroll layout when keyboard appear? this is my static page but when my keyboard appear then my scrollview is not working.i can not give hard code height of scrollview. please help me..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/settingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/splash_bg" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
</ScrollView>
Please help me out.
suggestions apreciated
Thanks Kind Regards.
Try this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/splash_bg" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
And add this code to ypur manifest project:
<activity
android:name="YourActivity"
android:windowSoftInputMode="stateVisible|stateAlwaysVisible" >
</activity>
add this code in ur manifest activty
android:windowSoftInputMode="adjustPan|stateAlwaysVisible"
this code useful for scrolling relative layout..
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="#+id/settingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/splash_bg" >
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/bottomRelay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="7.5dp"
android:background="#android:color/transparent"
android:visibility="gone" >
<TextView
android:id="#+id/Upload"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#ededed"
android:gravity="center"
android:text="Upload Photo"
android:textColor="#8F8F8F"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/Upload"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/choose_existing"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border1"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="1dp"
android:background="#ededed"
android:gravity="center"
android:text="Library"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/choose_existing"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/Camera"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border2"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="1dp"
android:background="#ededed"
android:gravity="center"
android:text="Camera"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/Camera"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/cancel"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border3"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="20dp"
android:background="#ededed"
android:gravity="center"
android:text="Cancel"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>

Android : Relativelayout in Framelayout not showing up (Custom Camera Preview Screen)

I need same as I attached image file Its Camera Preview Screen : I want to design two transparent layout over framelayout so it looks like this, but when I run it show only camera screen(Framelayout). It not showing two relative layouts.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:layout_gravity="top"
android:padding="15dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="01"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="5dp"
android:text="Status:"
android:textColor="#color/White" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView1"
android:layout_marginRight="78dp"
android:src="#drawable/heart" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_alignLeft="#+id/imageView3"
android:layout_marginTop="10dp"
android:src="#drawable/view" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageView3"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/imageView4"
android:text="125 Likes"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:text="STREAMING" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_alignTop="#+id/imageView4"
android:text="24 Viewers"
android:textColor="#color/White" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#77000000"
android:layout_gravity="bottom"
android:padding="10dp" >
<Button
android:id="#+id/button_capture"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/camera_record"
android:textColor="#color/White" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="50dp"
android:src="#drawable/view_video_big" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:src="#drawable/swipe_camera" />
</RelativeLayout>
</FrameLayout>
Add ids to the two RelativeLlayouts in layout file..
and get the view object by like this
RelativeLayout layout1=(RelativeLayout) findViewById(R.id.topRelativeLayout);
RelativeLayout layout2=(RelativeLayout) findViewById(R.id.bottomRelativeLayout);
and add this line in your onCreate and test once..
layout1.bringToFront();
layout2.bringToFront();
Try this first of all you have to set your background image to FrameLayout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="#drawable/ic_launcher"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:padding="15dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="01"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="5dp"
android:text="Status:"
android:textColor="#color/White" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView1"
android:layout_marginRight="78dp"
android:src="#drawable/heart" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_alignLeft="#+id/imageView3"
android:layout_marginTop="10dp"
android:src="#drawable/view" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageView3"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/imageView4"
android:text="125 Likes"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:text="STREAMING" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_alignTop="#+id/imageView4"
android:text="24 Viewers"
android:textColor="#color/White" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#77000000"
android:layout_gravity="bottom"
android:visibility="visible"
android:padding="10dp" >
<Button
android:id="#+id/button_capture"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/camera_record"
android:textColor="#color/White" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="50dp"
android:src="#drawable/view_video_big" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:src="#drawable/swipe_camera" />
</RelativeLayout>
</FrameLayout>
or follow this link.

Android-Relative Layout inside Scroll View with fixed header and footer

I want a page which has a static header and footer with scrollable content inside. This is my layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<LinearLayout
android:id="#+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/sendfunds" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footerView"
android:layout_below="#+id/headerView" >
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="26dp"
android:text="Balance"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="8pt"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="TextView" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="16dp"
android:layout_toRightOf="#+id/textView2"
android:text="TextView" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="34dp"
android:text="WHO ARE YOU SENDING MONEY TO?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="8pt" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView4"
android:layout_marginTop="35dp"
android:text="Recipient Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText1"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView5"
android:layout_alignBottom="#+id/textView5"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText1"
android:layout_marginTop="25dp"
android:text="Recipient Email"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView6"
android:layout_alignBottom="#+id/textView6"
android:layout_alignLeft="#+id/editText1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText2"
android:layout_marginTop="37dp"
android:text="HOW MUCH DO YOU WANT TO SEND?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="8pt" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView7"
android:layout_marginTop="34dp"
android:text="Amount"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView8"
android:layout_alignBottom="#+id/textView8"
android:layout_alignLeft="#+id/editText2"
android:layout_alignParentRight="true"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText3"
android:layout_marginTop="24dp"
android:text="Wallet Cat."
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText3"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView9" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignLeft="#+id/spinner1"
android:layout_marginLeft="22dp"
android:text="TextView"
android:visibility="gone" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView9"
android:layout_marginTop="35dp"
android:text="Pay Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView11"
android:layout_alignLeft="#+id/spinner1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView11"
android:layout_marginTop="27dp"
android:text="Detail Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView12"
android:layout_alignLeft="#+id/editText4"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView12"
android:layout_marginTop="39dp"
android:text="Date of Birth"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView13"
android:layout_alignLeft="#+id/editText5"
android:ems="10" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView13"
android:layout_marginTop="40dp"
android:text="Password"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView14"
android:layout_alignLeft="#+id/editText6"
android:layout_alignParentRight="true"
android:ems="10" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText7"
android:layout_marginTop="37dp"
android:layout_toLeftOf="#+id/textView3"
android:text="Submit" />
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/wallet_ic" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:src="#drawable/send_ic_hover" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView2"
android:src="#drawable/upload_ic" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView3"
android:src="#drawable/history1" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView4"
android:src="#drawable/more" />
</RelativeLayout>
</RelativeLayout>
With this I have the static header and footer but some of the scrollable content is missing. I tried increasing the height of the ScrollView and layout and fillViewport=true but no luck. How should I increase the height of the middle layout?
You can solve this by using a LinearLayout container instead of RelativeLayout container.
The container should have 3 children: Header, Content, and Footer. Where the Content's height is set to fill the remaining space. You can do that by using the weight attribute:
android:layout_height="0dp"
android:layout_weight="1"
Use this code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:id="#+id/headerView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/sendfunds" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Your Content -->
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/wallet_ic" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:src="#drawable/send_ic_hover" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView2"
android:src="#drawable/upload_ic" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView3"
android:src="#drawable/history1" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView4"
android:src="#drawable/more" />
</RelativeLayout>
</LinearLayout>
Notice that using
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true
is meaningless within LinearLayout. So this:
<LinearLayout
android:id="#+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/sendfunds" />
</LinearLayout>
is wrong.
try this layout with small change in your layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<LinearLayout
android:id="#+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/sendfunds" />
</LinearLayout>
<RelativeLayout
android:id="#+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/wallet_ic" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:src="#drawable/send_ic_hover" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView2"
android:src="#drawable/upload_ic" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView3"
android:src="#drawable/history1" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView4"
android:src="#drawable/more" />
</RelativeLayout>
<ScrollView
android:id="#+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footerView"
android:layout_below="#+id/headerView" >
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="26dp"
android:text="Balance"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="8pt"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="TextView" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="16dp"
android:layout_toRightOf="#+id/textView2"
android:text="TextView" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="34dp"
android:text="WHO ARE YOU SENDING MONEY TO?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="8pt" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView4"
android:layout_marginTop="35dp"
android:text="Recipient Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText1"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView5"
android:layout_alignBottom="#+id/textView5"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText1"
android:layout_marginTop="25dp"
android:text="Recipient Email"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView6"
android:layout_alignBottom="#+id/textView6"
android:layout_alignLeft="#+id/editText1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText2"
android:layout_marginTop="37dp"
android:text="HOW MUCH DO YOU WANT TO SEND?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="8pt" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView7"
android:layout_marginTop="34dp"
android:text="Amount"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView8"
android:layout_alignBottom="#+id/textView8"
android:layout_alignLeft="#+id/editText2"
android:layout_alignParentRight="true"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText3"
android:layout_marginTop="24dp"
android:text="Wallet Cat."
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText3"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView9" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignLeft="#+id/spinner1"
android:layout_marginLeft="22dp"
android:text="TextView"
android:visibility="gone" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView9"
android:layout_marginTop="35dp"
android:text="Pay Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView11"
android:layout_alignLeft="#+id/spinner1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView11"
android:layout_marginTop="27dp"
android:text="Detail Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView12"
android:layout_alignLeft="#+id/editText4"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView12"
android:layout_marginTop="39dp"
android:text="Date of Birth"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView13"
android:layout_alignLeft="#+id/editText5"
android:ems="10" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView13"
android:layout_marginTop="40dp"
android:text="Password"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView14"
android:layout_alignLeft="#+id/editText6"
android:layout_alignParentRight="true"
android:ems="10" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText7"
android:layout_marginTop="37dp"
android:layout_toLeftOf="#+id/textView3"
android:text="Submit" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
try this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation=”vertical” >
<LinearLayout
android:id="#+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/sendfunds" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=1
>
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="26dp"
android:text="Balance"
android:textStyle="bold"
android:textSize="8pt"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="TextView" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="16dp"
android:layout_toRightOf="#+id/textView2"
android:text="TextView" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="34dp"
android:text="WHO ARE YOU SENDING MONEY TO?"
android:textSize="8pt"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView4"
android:layout_marginTop="35dp"
android:text="Recipient Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText1"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView5"
android:layout_alignBottom="#+id/textView5"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText1"
android:layout_marginTop="25dp"
android:text="Recipient Email"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView6"
android:layout_alignBottom="#+id/textView6"
android:layout_alignLeft="#+id/editText1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText2"
android:layout_marginTop="37dp"
android:text="HOW MUCH DO YOU WANT TO SEND?"
android:textSize="8pt"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView7"
android:layout_marginTop="34dp"
android:text="Amount"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView8"
android:layout_alignBottom="#+id/textView8"
android:layout_alignLeft="#+id/editText2"
android:layout_alignParentRight="true"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText3"
android:layout_marginTop="24dp"
android:text="Wallet Cat."
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText3"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView9" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignLeft="#+id/spinner1"
android:layout_marginLeft="22dp"
android:text="TextView"
android:visibility="gone" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView9"
android:layout_marginTop="35dp"
android:text="Pay Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView11"
android:layout_alignLeft="#+id/spinner1"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView11"
android:layout_marginTop="27dp"
android:text="Detail Ref."
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView12"
android:layout_alignLeft="#+id/editText4"
android:layout_alignParentRight="true"
android:ems="10" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView12"
android:layout_marginTop="39dp"
android:text="Date of Birth"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView13"
android:layout_alignLeft="#+id/editText5"
android:ems="10" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView13"
android:layout_marginTop="40dp"
android:text="Password"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView14"
android:layout_alignLeft="#+id/editText6"
android:layout_alignParentRight="true"
android:ems="10" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText7"
android:layout_marginTop="37dp"
android:layout_toLeftOf="#+id/textView3"
android:text="Submit" />
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/wallet_ic" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView1"
android:src="#drawable/send_ic_hover" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/imageView2"
android:src="#drawable/upload_ic" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView3"
android:src="#drawable/history1" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/imageView4"
android:src="#drawable/more" />
</RelativeLayout>
</LinearLayout >

Categories

Resources