I want to display an horizontal linearlayout which content 3 imageview inside a vertical linearLayout
But i have a problem as you can see
Only the first Imageview is displayed , and he is in the center .
I changed the gravity for the other Imageview (left and right) but nothing changed .
The code :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context="info.androidhive.navigationdrawer.activity.FormActivity"
android:weightSum="1"
android:theme="#style/ThemeOverlay.AppCompat.Dark">
<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Ajouter Votre Annonce"
android:gravity="center"
android:textColor="#000000"
android:textSize="22sp"
/>
<Spinner
android:id="#+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="34dp"
android:layout_below="#+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:entries="#array/cat_arrays"
android:prompt="#string/cat_prompt"
/>
<RadioButton
android:id="#+id/radioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="23dp"
android:text="Offre"
android:layout_below="#+id/spinner"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#000000"
/>
<RadioButton
android:id="#+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/radioButton"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:text="Demande"
android:textColor="#000000"
/>
<Spinner
android:id="#+id/spinner4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/spinner3"
android:layout_marginTop="17dp"
android:entries="#array/vil_arrays"
android:prompt="#string/vil_prompt"
android:textColor="#808080"
/>
<EditText
android:id="#+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ems="10"
android:inputType="textPersonName"
android:hint="Titre de l'Annonce"
android:layout_below="#+id/spinner4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textColorHint="#808080"
android:textColor="#000000"
/>
<EditText
android:id="#+id/editText8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ems="10"
android:inputType="textPersonName"
android:hint="Prix en UM"
android:layout_below="#+id/spinner4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textColorHint="#808080"
android:textColor="#000000"
/>
<EditText
android:id="#+id/editText4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/editText"
android:layout_marginTop="16dp"
android:ems="10"
android:inputType="textPersonName"
android:hint="Description"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:textColorHint="#808080"
android:paddingBottom="75dp"
android:textColor="#000000"/>
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="27dp"
android:text="Vos Photos"
android:gravity="center"
android:textColor="#000000"
android:textSize="22sp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="#+id/img1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/imgadd"
android:gravity="left"
/>
<ImageView
android:id="#+id/img2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/imgadd"
android:gravity="center"/>
<ImageView
android:id="#+id/img3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/imgadd"
android:gravity="right"/>
</LinearLayout>
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/button3"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
android:text="Vos Informations"
android:gravity="center"
android:textColor="#000000"
android:textSize="22sp"
/>
<RadioButton
android:id="#+id/radioButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/button3"
android:layout_alignStart="#+id/button3"
android:layout_below="#+id/textView5"
android:text="Professionel"
android:textColor="#000000"
/>
<RadioButton
android:id="#+id/radioButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/radioButton3"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:text="Particulier"
android:textColor="#000000"
/>
<EditText
android:id="#+id/editText5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/button3"
android:layout_alignStart="#+id/button3"
android:layout_below="#+id/radioButton3"
android:layout_marginTop="26dp"
android:ems="10"
android:inputType="textPersonName"
android:hint="Nom et Prenom"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textColorHint="#808080"
/>
<EditText
android:id="#+id/editText6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText5"
android:layout_alignParentBottom="true"
android:layout_alignStart="#+id/editText5"
android:layout_marginBottom="10dp"
android:ems="10"
android:inputType="textPersonName"
android:hint="Telephone"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textColorHint="#808080"
/>
<EditText
android:id="#+id/editText7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText6"
android:layout_alignParentBottom="true"
android:layout_alignStart="#+id/editText6"
android:layout_marginBottom="10dp"
android:ems="10"
android:inputType="textPassword"
android:hint="Mot de passe"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textColorHint="#808080"/>
<Button
android:id="#+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:text="Déposez votre Annonce"
android:background="#a4c639"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:textColorHint="#808080"/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="#+id/img1"
android:layout_width="0dp"
android:layout_weight = "1"
android:layout_height="wrap_content"
android:src="#drawable/imgadd"/>
<ImageView
android:id="#+id/img2"
android:layout_width="0dp"
android:layout_weight = "1"
android:layout_height="wrap_content"
android:src="#drawable/imgadd"/>
<ImageView
android:id="#+id/img3"
android:layout_width="0dp"
android:layout_weight = "1"
android:layout_height="wrap_content"
android:src="#drawable/imgadd"/>
</LinearLayout>
Try this code:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="#+id/img1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/imgadd"/>
<ImageView
android:id="#+id/img2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/imgadd"/>
<ImageView
android:id="#+id/img3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/imgadd"/>
</LinearLayout>
It can be fixed in multiple ways. What i would do is to assign layout_weight tag to all 3 images in the horizontal linear layout . something like this.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="#+id/img1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/imgadd"
android:layout_weight ="1"
/>
<ImageView
android:id="#+id/img2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight ="1"
android:src="#drawable/imgadd"
/>
<ImageView
android:id="#+id/img3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight ="1"
android:src="#drawable/imgadd"
/>
</LinearLayout>
Also remove the gravity tag in all three image views .
Related
I am trying to use horizontal scrollview inside a scroll view. My parent scroll isn't scrolling smoothly. Although my child scroll is scrolling smoothly, I want to achieve smooth scrolling of parent scroll. I have tried every method, I have in my mind setting HardwareAccelerated to false worked but it removed elevation from my views.
Main Activity
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ECEFF1"
android:clipToPadding="false">
<RelativeLayout
android:layout_width="250dp"
android:layout_height="90dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="75dp"
android:layout_marginTop="100dp"
android:background="#drawable/round_corners"
android:clipToPadding="false"
android:elevation="5dp"
android:translationZ="5dp"
tools:layout_editor_absoluteX="42dp"
tools:layout_editor_absoluteY="121dp">
<ImageView
android:id="#+id/enquiry"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/visa"
android:layout_marginEnd="35dp"
app:srcCompat="#drawable/phone" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/textView2"
android:layout_marginEnd="20dp"
android:text="Enquiry"
android:textColor="#color/navigationBarColor"
android:textSize="15sp" />
<ImageView
android:id="#+id/visa"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignTop="#+id/holidays"
android:layout_centerHorizontal="true"
app:srcCompat="#drawable/globe" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView3"
android:layout_centerHorizontal="true"
android:text="Visa"
android:textColor="#android:color/background_dark"
android:textSize="15sp" />
<ImageView
android:id="#+id/holidays"
android:layout_width="25dp"
android:layout_height="32dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="35dp"
android:layout_marginTop="18dp"
app:srcCompat="#drawable/plane" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="14dp"
android:layout_marginStart="20dp"
android:text="Holidays"
android:textColor="#android:color/background_dark" />
</RelativeLayout>
<include
android:id="#+id/toolbar"
layout="#layout/app_bar" />
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="false"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#color/colorPrimary"
android:fontFamily="serif"
android:text="Call"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
<ScrollView
android:id="#+id/parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="200dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="50dp"
android:text="Pilgrimage"
android:textColor="#android:color/background_dark"
android:textSize="25sp"
android:textStyle="bold" />
<android.support.v7.widget.CardView
android:id="#+id/pilg"
class="com.example.admin.myapplication.Pilgrimage"
android:layout_width="320dp"
android:layout_height="240dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/round_corners"
android:elevation="5dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#drawable/hu" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="155dp"
android:fontFamily="serif"
android:text="Hajj And Umrah"
android:textColor="#color/navigationBarColor"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="190dp"
android:text="Ramzan Umrah"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="210dp"
android:layout_marginTop="190dp"
android:text="29 Days/30 Nights"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="205dp"
android:text="Starts From Rs.65,000/-"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Holiday Packages"
android:textColor="#color/navigationBarColor"
android:textSize="25sp"
android:textStyle="bold" />
<HorizontalScrollView
android:id="#+id/child"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/international"
class="com.example.admin.myapplication.International"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/ll"
android:elevation="5dp"
android:padding="-25dp">
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="11dp"
android:fontFamily="serif"
android:text="International"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/dom1"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/rajasthan"
android:elevation="5dp">
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:fontFamily="serif"
android:text="Domestic"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Social"
android:textColor="#color/navigationBarColor"
android:textSize="25sp" />
<LinearLayout
android:layout_width="335dp"
android:layout_height="50dp"
android:layout_marginBottom="100dp"
android:layout_marginLeft="25dp"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</ScrollView>
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:fontFamily="serif"
android:text="Al Shariq Enterprises"
android:textColor="#color/textColorPrimary"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
Try this NestedScrollView like this :-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="200dp">
<android.support.v4.widget.NestedScrollView
android:id="#+id/parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="50dp"
android:text="Pilgrimage"
android:textColor="#android:color/background_dark"
android:textSize="25sp"
android:textStyle="bold" />
<android.support.v7.widget.CardView
android:id="#+id/pilg"
class="com.example.admin.myapplication.Pilgrimage"
android:layout_width="320dp"
android:layout_height="240dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/round_corners"
android:elevation="5dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#drawable/hu" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="155dp"
android:fontFamily="serif"
android:text="Hajj And Umrah"
android:textColor="#color/navigationBarColor"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="190dp"
android:text="Ramzan Umrah"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="210dp"
android:layout_marginTop="190dp"
android:text="29 Days/30 Nights"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="205dp"
android:text="Starts From Rs.65,000/-"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Holiday Packages"
android:textColor="#color/navigationBarColor"
android:textSize="25sp"
android:textStyle="bold" />
<HorizontalScrollView
android:id="#+id/child"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/international"
class="com.example.admin.myapplication.International"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/ll"
android:elevation="5dp"
android:padding="-25dp">
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="11dp"
android:fontFamily="serif"
android:text="International"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/dom1"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/rajasthan"
android:elevation="5dp">
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:fontFamily="serif"
android:text="Domestic"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Social"
android:textColor="#color/navigationBarColor"
android:textSize="25sp" />
<LinearLayout
android:layout_width="335dp"
android:layout_height="50dp"
android:layout_marginBottom="100dp"
android:layout_marginLeft="25dp"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
For basic details you can check this link.
I think that this happens because both of your ScrollViews reacts to scrolling so it seems to you that it lags, but it actually don't, its just vertical ScrollView interrupting horizontal ScrollView.
It is not recommended using ScrollView inside another ScrollView. Instead use NestedScrollView as in this answer.
How can I adjust the imageButton in the center of ImageView?
Below are the code I have tried:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/Theme.AppCompat"
android:background="#color/darkpurple"
android:minHeight="?attr/actionBarSize">
<Button
android:text="Save"
android:id="#+id/save"
android:background="#color/darkpurple"
android:layout_width="wrap_content"
android:layout_gravity="right"
android:textColor="#fff"
android:layout_height="wrap_content"
android:textSize="12sp" />
</android.support.v7.widget.Toolbar>
<ImageView
android:layout_height="200dp"
android:layout_width="200dp"
android:layout_marginTop="15dp"
android:background="#color/light_gray"
android:layout_below="#+id/toolbar"
android:layout_marginRight="25dp"
android:layout_alignParentRight="true"
android:id="#+id/imageView"
android:layout_gravity="center_horizontal" />
<Button
android:layout_width="65dp"
android:background="#drawable/camera"
android:layout_height="55dp"
android:layout_marginRight="5dp"
android:id="#+id/imageButtonOne"
android:paddingTop="100dp"
android:layout_marginTop="67dp"
android:layout_alignTop="#+id/imageView"
android:layout_alignRight="#+id/comments"
android:layout_alignEnd="#+id/comments" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/imageView"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:id="#+id/Date"
android:textSize="15sp"
android:text="Date"/>
<EditText
android:layout_width="match_parent"
android:id="#+id/date"
android:layout_below="#+id/Date"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:textSize="15sp"
android:hint="Date"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:id="#+id/Amount"
android:textSize="15sp"
android:text="Amount"
android:layout_below="#+id/date" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/Amount"
android:paddingLeft="20dp"
android:id="#+id/amount"
android:inputType="numberDecimal"
android:textSize="15sp"
android:hint="Amount"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textStyle="bold"
android:id="#+id/Comments"
android:textSize="15sp"
android:text="Comments"
android:layout_below="#+id/amount" />
<EditText
android:layout_width="290dp"
android:layout_height="120dp"
android:paddingBottom="80dp"
android:layout_marginTop="15dp"
android:layout_marginLeft="10dp"
android:paddingLeft="13dp"
android:id="#+id/comments"
android:textSize="15sp"
android:background="#drawable/roundedcorner_edittext"
android:hint="Comments"
android:layout_below="#+id/Comments"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
My ScreenShot
<FrameLayout android:layout_height="200dp"
android:layout_width="200dp"
android:layout_below="#+id/toolbar"
android:layout_marginRight="25dp"
android:layout_marginTop="15dp"
android:layout_alignParentRight="true">
<ImageView
android:layout_height="200dp"
android:layout_width="200dp"
android:background="#color/light_gray"
android:id="#+id/imageView"
android:layout_gravity="center_horizontal" />
<Button
android:layout_width="65dp"
android:background="#drawable/camera"
android:layout_height="55dp"
android:id="#+id/imageButtonOne"
android:layout_gravity = "center"
/>
</FrameLayout>
Check it.
Use code, it works for all screen size(Please replace image with yours):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/Theme.AppCompat"
android:background="#color/colorPrimary"
android:minHeight="?attr/actionBarSize">
<Button
android:text="Save"
android:id="#+id/save"
android:background="#color/colorPrimary"
android:layout_width="wrap_content"
android:layout_gravity="right"
android:textColor="#fff"
android:layout_height="wrap_content"
android:textSize="12sp" />
</android.support.v7.widget.Toolbar>
<ImageView
android:layout_height="200dp"
android:layout_width="200dp"
android:layout_marginTop="15dp"
android:background="#color/colorPrimary"
android:layout_below="#+id/toolbar"
android:layout_marginRight="25dp"
android:layout_alignParentRight="true"
android:id="#+id/imageView"
android:layout_gravity="center_horizontal" />
<Button
android:layout_width="70dp"
android:background="#mipmap/ic_launcher"
android:layout_height="60dp"
android:layout_marginTop="70dp"
android:layout_marginRight="65dp"
android:id="#+id/imageButtonOne"
android:layout_alignTop="#+id/imageView"
android:layout_alignEnd="#+id/imageView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/imageView"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textColor="#color/colorPrimary"
android:textStyle="bold"
android:id="#+id/Date"
android:textSize="15sp"
android:text="Date"/>
<EditText
android:layout_width="match_parent"
android:id="#+id/date"
android:layout_below="#+id/Date"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:textSize="15sp"
android:hint="Date"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textColor="#color/colorPrimary"
android:textStyle="bold"
android:id="#+id/Amount"
android:textSize="15sp"
android:text="Amount"
android:layout_below="#+id/date" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/Amount"
android:paddingLeft="20dp"
android:id="#+id/amount"
android:inputType="numberDecimal"
android:textSize="15sp"
android:hint="Amount"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textStyle="bold"
android:id="#+id/Comments"
android:textSize="15sp"
android:text="Comments"
android:layout_below="#+id/amount" />
<EditText
android:layout_width="290dp"
android:layout_height="120dp"
android:paddingBottom="80dp"
android:layout_marginTop="15dp"
android:layout_marginLeft="10dp"
android:paddingLeft="13dp"
android:id="#+id/comments"
android:textSize="15sp"
android:background="#mipmap/ic_launcher"
android:hint="Comments"
android:layout_below="#+id/Comments"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
The idea is simple, make changes according to this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="250dp"
android:layout_height="250dp" >
<ImageView
android:id="#+id/base"
android:layout_height="250dp"
android:layout_width="250dp"
android:src="#drawable/home"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<ImageButton
android:id="#+id/center"
android:layout_height="150dp"
android:layout_width="150dp"
android:src="#drawable/home"
android:layout_centerInParent="true"
android:layout_centerVertical="true" />
</RelativeLayout>
</RelativeLayout>
In order to move it to the top right corner, you can specify
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
to the Relative Layout with fixed widths, This places the Layout at the top right corner, then you can add margins to keep at a position where you require.
Hope it helps :)
Past this as it is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/Theme.AppCompat"
android:background="#color/darkpurple"
android:minHeight="?attr/actionBarSize">
<Button
android:text="Save"
android:id="#+id/save"
android:background="#color/darkpurple"
android:layout_width="wrap_content"
android:layout_gravity="right"
android:textColor="#fff"
android:layout_height="wrap_content"
android:textSize="12sp" />
</android.support.v7.widget.Toolbar>
<RelativeLayout
android:id="#+id/rlImages"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerHorizontal="true"
android:layout_below="#+id/toolbar"
android:layout_marginRight="25dp"
android:layout_marginTop="15dp">
<ImageView
android:id="#+id/imageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#color/light_gray" />
<Button
android:id="#+id/imageButtonOne"
android:layout_width="65dp"
android:layout_height="55dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/add_tag" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rlImages"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:id="#+id/Date"
android:textSize="15sp"
android:text="Date"/>
<EditText
android:layout_width="match_parent"
android:id="#+id/date"
android:layout_below="#+id/Date"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:textSize="15sp"
android:hint="Date"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:id="#+id/Amount"
android:textSize="15sp"
android:text="Amount"
android:layout_below="#+id/date" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/Amount"
android:paddingLeft="20dp"
android:id="#+id/amount"
android:inputType="numberDecimal"
android:textSize="15sp"
android:hint="Amount"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:textStyle="bold"
android:id="#+id/Comments"
android:textSize="15sp"
android:text="Comments"
android:layout_below="#+id/amount" />
<EditText
android:layout_width="290dp"
android:layout_height="120dp"
android:paddingBottom="80dp"
android:layout_marginTop="15dp"
android:layout_marginLeft="10dp"
android:paddingLeft="13dp"
android:id="#+id/comments"
android:textSize="15sp"
android:background="#drawable/roundedcorner_edittext"
android:hint="Comments"
android:layout_below="#+id/Comments"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
You need to use RelativeLayout with the use of
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
You can use FrameLayout with that
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="center"
android:src="#drawable/img" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_gravity="center_horizontal|bottom"
android:padding="12dip"
android:background="#000000"
android:textColor="#ffffffff"
android:text="Button" />
</FrameLayout>
I really do not understand why in a device with a small screen the scrollview not scroll to the end.
Look q'm saying:
I researched and saw that could be caused due to the 'margin' but I do not remember to be using.
Here is my layout file with the ScrollView:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="br.com.petrobressa.Inicio$PlaceholderFragment"
android:fillViewport="false"
android:layout_weight="1">
<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="wrap_content"
android:padding="#dimen/activity_horizontal_margin">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTextLabel"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/view">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:hint="Agendar para o dia..."
android:imeActionLabel="Data"
android:drawableRight="#drawable/ic_today"
android:layout_below="#+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:editable="false"
android:inputType="date"
android:maxLines="1"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Selecionar horario:"
android:id="#+id/textView"
android:textColor="#color/colorPrimaryDark"
android:layout_below="#+id/view"
android:layout_alignLeft="#+id/view"
android:layout_alignStart="#+id/view" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="#+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/linearLayout3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/ivImage"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="#drawable/ic_alarm"
android:tint="#color/colorPrimaryDark"
android:layout_marginTop="12dp" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/spinner"
android:layout_below="#+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:spinnerMode="dialog" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="8dp"
android:layout_gravity="center_horizontal"
android:gravity="center|center_vertical|center_horizontal">
<ImageView
android:id="#+id/ivImageNotificar"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="#drawable/ic_info"
android:tint="#color/colorPrimaryDark" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Este horario ja foi reservado!"
android:textStyle="bold"
android:gravity="center_horizontal"
android:id="#+id/tvNotificar" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Selecionar tipo de veiculo:"
android:id="#+id/textView2"
android:textColor="#color/colorPrimaryDark"
android:layout_below="#+id/linearLayout3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="false" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/spinner2"
android:spinnerMode="dropdown"
android:layout_alignParentStart="true"
android:layout_below="#+id/textView2"
android:layout_alignParentLeft="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Reservar"
android:background="#color/colorPrimary"
android:textColor="#color/colorIcons"
android:id="#+id/button"
android:layout_below="#+id/spinner2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_margin="50dp" />
</RelativeLayout>
</ScrollView>
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.