I am trying to give a scroll view for a linear layout inside a relative layout , actually the linear layout is used to inflate textview and buttons but after doing changes also iam not getting the scroller please help me This is my xml file pleas e help me iam new to android
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<EditText
android:id="#+id/editText1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:ems="10"
android:hint="Search item" />
<EditText
android:id="#+id/editText2"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/editText1"
android:ems="10"
android:hint="Qty"
android:inputType="numberDecimal" >
<requestFocus />
</EditText>
<Button
android:id="#+id/add_to_bill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText2"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="Add"
android:textSize="20sp" />
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="175dp"
android:layout_above="#+id/textView1"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText1" >
</ListView>
<LinearLayout
android:id="#+id/billshow"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:layout_above="#+id/submit_bill"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:orientation="vertical" >
</LinearLayout>
<Button
android:id="#+id/submit_bill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:text="Submit" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/billshow"
android:layout_alignParentLeft="true"
android:text="Item"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/billshow"
android:layout_alignRight="#+id/editText1"
android:layout_marginRight="14dp"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/submit_bill"
android:layout_below="#+id/list"
android:text="Qty"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
I got the solution , thank you all anyways
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<EditText
android:id="#+id/editText1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:ems="10"
android:hint="Search item" />
<EditText
android:id="#+id/editText2"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/editText1"
android:ems="10"
android:hint="Qty"
android:inputType="numberDecimal" >
<requestFocus />
</EditText>
<Button
android:id="#+id/add_to_bill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText2"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="Add"
android:textSize="20sp" />
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText1" >
</ListView>
<Button
android:id="#+id/submit_bill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:text="Submit" />
<ScrollView
android:id="#+id/scroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/submit_bill"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView2"
android:scrollbars="horizontal" >
<LinearLayout
android:id="#+id/billshow"
android:layout_width="fill_parent"
android:layout_height="278dp"
android:layout_above="#+id/submit_bill"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/list"
android:layout_toLeftOf="#+id/submit_bill"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceLarge" />
<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_centerHorizontal="true"
android:text="Qty"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_alignParentLeft="true"
android:text="Item"
android:textAppearance="?android:attr/textAppearanceLarge" />
Related
I am trying to align my buttons at the bottom of the screen using layouts but I cannot figure what's wrong with my code. I have tried several options by nesting different layouts but with no good outcome. it looks like this right now
And my code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/relLayout"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:clickable="true"
android:focusableInTouchMode="true"
tools:context="com.example.aurora.personalinformation.MainActivity">
<!-- Make the parent view clickable and focusable -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/title"
android:layout_centerHorizontal="true"
android:id="#+id/title"
android:textColor="#FF0000"
android:textSize="25dp"
android:textAlignment="center" />
<TextView
android:id="#+id/nameLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="15dp"
android:layout_marginTop="40dp"
android:layout_below="#id/title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText android:id="#+id/edit_name"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter name"
android:layout_alignBottom="#id/nameLable"
android:layout_toRightOf="#+id/phoneLable"
android:layout_toEndOf="#+id/phoneLable"
/>
<TextView
android:id="#+id/addressLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:textColor="#000000"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignBottom="#+id/addressField"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:id="#+id/addressField"
android:layout_weight="0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your address"
android:layout_below="#id/edit_name"
android:layout_alignLeft="#id/edit_name"
android:layout_alignStart="#id/edit_name" />
<TextView
android:id="#+id/phoneLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/phone"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="15dp"
android:layout_below="#id/addressField"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp"/>
<EditText
android:id="#+id/phoneField"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your phone number"
android:layout_below="#id/addressField"
android:layout_toRightOf="#id/phoneLable"
android:layout_toEndOf="#id/phoneLable" />
<TextView
android:id="#+id/emailLable"
android:layout_below="#id/phoneLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/email"
android:textColor="#000000"
android:textSize="15dp"
android:textStyle="bold"
android:layout_marginTop="20dp"/>
<EditText
android:id="#+id/emailField"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your email"
android:layout_below="#id/phoneField"
android:layout_alignLeft="#id/phoneField"
android:layout_alignStart="#id/phoneField" />
<TextView
android:id="#+id/genderLable"
android:layout_below="#id/emailLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/gender"
android:layout_marginTop="20dp"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="15dp" />
<Spinner
android:id="#+id/gender"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:entries="#array/gender"
android:layout_alignTop="#+id/genderLable"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignLeft="#+id/emailField"
android:layout_alignStart="#+id/emailField" />
<TextView
android:id="#+id/country"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Country"
android:textColor="#000000"
android:textSize="15dp"
android:textStyle="bold"
android:layout_below="#id/gender"
android:layout_marginTop="15dp"/>
<AutoCompleteTextView
android:id="#+id/countryField"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your email"
android:layout_below="#id/gender"
android:layout_toRightOf="#id/phoneLable"
android:layout_toEndOf="#id/phoneLable" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_alignParentBottom="true">
<Button
android:id="#+id/buttonSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:id="#+id/buttonCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
just give your last RelativeLayout like this:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_below="#+id/countryField"
android:layout_alignParentBottom="true">
<Button
android:id="#+id/buttonSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:id="#+id/buttonCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
One more thing there is no meaning to give an orientation to RelativeLayout.
I have a screen with relative layouts which contains images and text views.I am trying to add one text view but it is not showing up..I can't find out the reason.This is my whole xml:
<?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" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#drawable/orangestrip"
android:gravity="left|center"
android:text="Choose your flag, Pay in your Home currency"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:background="#drawable/orangestrip"
android:gravity="left|center"
android:text="اختيار العلم الخاص بك، ودفع بالعملة المحلية الخاصة بك"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#drawable/stripblue"
android:gravity="center"
android:text="Cancel"
android:textColor="#ffffff" />
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="450dp"
android:layout_height="500dp"
android:layout_above="#+id/button1"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView4"
android:background="#drawable/imageborder" >
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="450dp"
android:layout_height="500dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="#drawable/imageborder" >
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="400dp"
android:layout_height="320dp"
android:layout_above="#+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="17dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageButton1"
android:layout_alignParentBottom="true"
android:layout_marginLeft="85dp"
android:text="curr"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="35sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView2"
android:layout_alignLeft="#+id/textView2"
android:gravity="center"
android:text="rate"
android:textColor="#android:color/black" />
</RelativeLayout>
<RelativeLayout
android:layout_width="450dp"
android:layout_height="500dp"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/relativeLayout1"
android:background="#drawable/imageborder" >
<ImageButton
android:id="#+id/imageButton2"
android:layout_width="400dp"
android:layout_height="320dp"
android:layout_above="#+id/textView3"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:background="#drawable/uae" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignRight="#+id/imageButton2"
android:layout_marginRight="123dp"
android:text="curr"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="35sp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_above="#+id/relativeLayout2"
android:layout_alignParentRight="true"
android:background="#null"
android:src="#drawable/mashreqlogosmall" />
</RelativeLayout>
</LinearLayout>
This is the relative layout where I am trying to add the text view but its not showing up...textview with id textview5 is not showing up.
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="450dp"
android:layout_height="500dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="#drawable/imageborder" >
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="400dp"
android:layout_height="320dp"
android:layout_above="#+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="17dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageButton1"
android:layout_alignParentBottom="true"
android:layout_marginLeft="85dp"
android:text="curr"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="35sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView2"
android:layout_alignLeft="#+id/textView2"
android:gravity="center"
android:text="rate"
android:textColor="#android:color/black" />
</RelativeLayout>
please help..
try like this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativeLayout1"
android:layout_width="450dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="#drawable/ic_launcher" >
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="400dp"
android:layout_height="320dp"
android:layout_above="#+id/textView5"
android:layout_centerHorizontal="true"
android:layout_marginBottom="17dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageButton1"
android:layout_alignParentBottom="true"
android:layout_marginLeft="85dp"
android:text="curr"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="35sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView2"
android:layout_alignLeft="#+id/textView2"
android:gravity="center"
android:text="rate"
android:textColor="#android:color/black" />
</RelativeLayout>
i have one RelativeLayout and i have some views(image and edittexts) and now i want to use scrollview.this is a my xml code
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginTop="70dp" >
<ImageView
android:id="#+id/loginbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/passwordfild"
android:layout_alignRight="#+id/passwordfild"
android:layout_below="#+id/passwordfild"
android:layout_marginTop="28dp"
android:background="#drawable/login"
android:textColor="#ffffff" />
<EditText
android:id="#+id/passwordfild"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/namefild"
android:layout_alignRight="#+id/namefild"
android:layout_centerVertical="true"
android:background="#drawable/edittextbackground"
android:ems="10"
android:hint="პაროლი"
android:inputType="textPassword"
android:paddingLeft="15dp"
android:textColorHint="#e2e0e0" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/namefild"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/passwordfild"
android:layout_marginBottom="42dp"
android:layout_marginLeft="175dp"
android:layout_marginRight="175dp"
android:background="#drawable/edittextbackground"
android:ems="10"
android:hint="სახელი"
android:paddingLeft="15dp"
android:textColorHint="#e2e0e0" >
<requestFocus />
</EditText>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/namefild"
android:layout_alignLeft="#+id/namefild"
android:layout_alignRight="#+id/namefild"
android:layout_marginBottom="100dp"
android:background="#drawable/icon" />
</RelativeLayout>
also i added
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="70dp" >
and i inserted my relative layout inside my scrollview but design has changed.i have no idea what am i doing wrong
if anyone knows solution please help me
use android:fillViewport="true" inside the ScrollView
do like this,
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E0FFFF" >
<TextView
android:id="#+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:text="Portal Trading Ltd."
android:textSize="18sp"
android:textStyle="italic" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tvSackNo"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Santa Sacks"
android:textSize="40sp" />
<Button
android:id="#+id/btnEdit"
android:layout_width="100dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="21dp"
android:text="Edit"
android:textSize="25sp" />
<Button
android:id="#+id/btnConfirm"
android:layout_width="100dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="21dp"
android:text="Confirm"
android:textSize="21sp" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView2"
android:gravity="center"
android:text="Printed Name Details"
android:textSize="22sp" />
<TextView
android:id="#+id/tvExtraCharge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView3"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="Confirmation Page"
android:textSize="12sp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/btnEdit"
android:layout_alignParentLeft="true"
android:layout_below="#+id/tvExtraCharge"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/sackscontainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
I have a ListView that I'm populating with an ArrayAdapter.Its work fine most of devices.But i have one karbonn(320x480) device which unable to display list.My application contain many listview they display properly on karbonn.
My .xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e6f0f5"
tools:context=".Save_educationActivity" >
<RelativeLayout
android:id="#+id/btnlayout"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#4791FF"
android:orientation="horizontal" >
<ImageButton
android:id="#+id/xibtn_save_education"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="5dp"
android:background="#4791FF"
android:src="#drawable/ic_action_save" />
<ImageButton
android:id="#+id/xibtn_back_to_education"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:background="#4791FF"
android:src="#drawable/ic_action_back" />
</RelativeLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnlayout"
android:layout_marginTop="3dp"
android:text="#string/Education_title" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Course Name"
android:textSize="18dp"
android:textStyle="bold" />
</RelativeLayout>
</ScrollView>
<EditText
android:id="#+id/xedt_course"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/scrollView1"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/xedt_course"
android:text="Date"
android:textSize="18dp"
android:textStyle="bold" />
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView3"
android:text="Joining Date"
android:textSize="18dp" />
<TextView
android:id="#+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/TextView01"
android:layout_alignBottom="#+id/TextView01"
android:layout_alignLeft="#+id/lvdate"
android:text="Leave Date"
android:textSize="18dp" />
<EditText
android:id="#+id/jdate"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/TextView01"
android:ems="10"
android:hint="Joining Date"
android:inputType="textPersonName" />
<EditText
android:id="#+id/lvdate"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/TextView02"
android:ems="10"
android:hint="Leaving Date"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="#+id/jdate"
android:layout_marginTop="10dp"
android:background="#ffffff"
android:orientation="horizontal" >
<Button
android:id="#+id/btn_education_desc"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:background="#drawable/date_stroke"
android:text="Add Description"
android:textColor="#ffffff"
android:textSize="20dp" />
<ImageButton
android:id="#+id/add_edu_desc"
android:layout_width="70dp"
android:layout_height="match_parent"
android:background="#drawable/date_stroke"
android:src="#drawable/ic_action_new"
android:visibility="gone" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/linearLayout1">
<ListView
android:id="#+id/lst_eductndesc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true" >
</ListView>
</RelativeLayout>
</RelativeLayout>
You have very buggy layout. I will show you tour mistakes:
<RelativeLayout
android:id="#+id/btnlayout"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#4791FF"
android:orientation="horizontal" > // there is no such attribute in relative layout
<ImageButton
android:id="#+id/xibtn_save_education"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="5dp"
android:background="#4791FF"
android:src="#drawable/ic_action_save" />
<ImageButton
android:id="#+id/xibtn_back_to_education"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:background="#4791FF"
android:src="#drawable/ic_action_back" />
</RelativeLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnlayout"
android:layout_marginTop="3dp"
android:text="#string/Education_title" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" // which size of scroll view you expected here? It will grow with their content and never have scroll.
android:layout_below="#+id/textView1" >
<RelativeLayout // you don't need to have relative layout here.
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Course Name"
android:textSize="18dp"
android:textStyle="bold" />
</RelativeLayout>
</ScrollView>
<EditText
android:id="#+id/xedt_course"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/scrollView1"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/xedt_course"
android:text="Date"
android:textSize="18dp"
android:textStyle="bold" />
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView3"
android:text="Joining Date"
android:textSize="18dp" />
<TextView
android:id="#+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/TextView01"
android:layout_alignBottom="#+id/TextView01"
android:layout_alignLeft="#+id/lvdate"
android:text="Leave Date"
android:textSize="18dp" />
<EditText
android:id="#+id/jdate"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/TextView01"
android:ems="10"
android:hint="Joining Date"
android:inputType="textPersonName" />
<EditText
android:id="#+id/lvdate"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/TextView02"
android:ems="10"
android:hint="Leaving Date"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="#+id/jdate"
android:layout_marginTop="10dp"
android:background="#ffffff"
android:orientation="horizontal" >
<Button
android:id="#+id/btn_education_desc"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:background="#drawable/date_stroke"
android:text="Add Description"
android:textColor="#ffffff"
android:textSize="20dp" />
<ImageButton
android:id="#+id/add_edu_desc"
android:layout_width="70dp"
android:layout_height="match_parent"
android:background="#drawable/date_stroke"
android:src="#drawable/ic_action_new"
android:visibility="gone" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" // which height you expect here? It will have height the same as parent, but draws somewhere at the bottom. It will draw a large part of view outside of screen.
android:layout_below="#+id/linearLayout1">
<ListView
android:id="#+id/lst_eductndesc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true" >
</ListView>
</RelativeLayout>
I think you need reformat your layout at all. If you will show image what you want to achieve and explain it's behavior, I will help to write more effeicient and clean xml.
You can make your layout like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e6f0f5"
tools:context=".Save_educationActivity"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/btnlayout"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#4791FF"
android:orientation="horizontal" > // there is no such attribute in relative layout
<ImageButton
android:id="#+id/xibtn_save_education"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="5dp"
android:background="#4791FF"
android:src="#drawable/ic_action_save" />
<ImageButton
android:id="#+id/xibtn_back_to_education"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:background="#4791FF"
android:src="#drawable/ic_action_back" />
</RelativeLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="#string/Education_title" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="50dp" // you must declare your height exactly here
>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Course Name"
android:textSize="18dp"
android:textStyle="bold" />
</ScrollView>
<EditText
android:id="#+id/xedt_course"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/scrollView1"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/xedt_course"
android:text="Date"
android:textSize="18dp"
android:textStyle="bold" />
<LinearLayout layout_width="match_parent"
layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout layout_width="0dp"
laout_weight="1"
layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView3"
android:text="Joining Date"
android:textSize="18dp" />
<EditText
android:id="#+id/jdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Joining Date"
android:inputType="textPersonName" />
</LinearLayout>
<LinearLayout layout_width="0dp"
laout_weight="1"
layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Leave Date"
android:textSize="18dp" />
<EditText
android:id="#+id/lvdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Leaving Date"
android:inputType="textPersonName" >
</EditText>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="#ffffff"
android:orientation="horizontal" >
<Button
android:id="#+id/btn_education_desc"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:background="#drawable/date_stroke"
android:text="Add Description"
android:textColor="#ffffff"
android:textSize="20dp" />
<ImageButton
android:id="#+id/add_edu_desc"
android:layout_width="70dp"
android:layout_height="match_parent"
android:background="#drawable/date_stroke"
android:src="#drawable/ic_action_new"
android:visibility="gone" />
</LinearLayout>
<ListView
android:id="#+id/lst_eductndesc"
android:layout_width="match_parent"
android:layout_height="0dp"
layout_weight="1"
android:layout_centerHorizontal="true" >
</LinearLayout>
Since you're using RelativeLayouts and aligning your views beneath one another, it's likely that the layout is extending beyond the bottom of the screen.
I encourage you to use a different combination of ViewGroups, for instance using a vertically oriented LinearLayout inside a ScrollView.
i have a layout in my android project it takes input from edittext and sends the mail from this information but in layout the background does not show up on whole screen it leaves some space at the bottom so it do not look good
this is my layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbarStyle="insideOverlay"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="530dp"
android:background="#drawable/f4kf6msk"
android:fillViewport="true"
>
<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="#string/to"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#6495ed" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/to"
android:text="#string/app"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#6495ed" />
<EditText
android:id="#+id/from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:textColor="#6495ed"
android:textStyle="bold"
android:layout_below="#+id/textView2"
android:ems="10"
android:hint="#string/from"
android:inputType="textEmailAddress" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:ems="10"
android:textColor="#6495ed"
android:textStyle="bold"
android:hint="#string/too"
android:inputType="textEmailAddress"
/>
<Button
android:id="#+id/button1d"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/message"
android:background="#android:color/transparent"
android:gravity="center"
android:text="#string/send"
android:textColor="#6495ed" />
<View
android:id="#+id/View0dfd1"
android:layout_width="fill_parent"
android:layout_height="3dip"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#808080"
android:paddingBottom="3dp" />
<EditText
android:id="#+id/subject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView3"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="23dp"
android:textColor="#6495ed"
android:hint="#string/sub1"
android:textStyle="bold"
android:ems="10" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/from"
android:text="#string/sub"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#6495ed"
android:textStyle="bold" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView5"
android:layout_marginTop="39dp"
android:text="#string/Message"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#6495ed"
android:textStyle="bold" />
<EditText
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/subject"
android:ems="10"
android:gravity="top"
android:hint="#string/mess"
android:inputType="textMultiLine"
android:lines="11"
android:textColor="#6495ed"
android:textStyle="bold" />
<View
android:id="#+id/View0sd1"
android:layout_width="fill_parent"
android:layout_height="3dip"
android:layout_alignParentLeft="true"
android:layout_alignTop="#+id/button1d"
android:layout_marginTop="14dp"
android:background="#808080"
android:paddingBottom="3dp" />
</RelativeLayout>
</ScrollView>
try to put backround in scroll view property instead in relative layout