How to fix background image with scrollview when windowSoftInputMode appears.
I used windowSoftInputMode="adjustPan",but scrollview doesn't work
completely, please help me. Last fields do not appear when virtual keyboard
appears.
I want that background image should not scroll up with virtual keyboard
and scrollview should show all the fields inside it while scrolling.
Here is my code
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/back">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cancel_done_btn"
android:layout_marginLeft="30dp"
android:layout_marginTop="40dp"
android:textSize="17dp"
android:paddingTop="10dp"
android:textStyle="bold"
android:paddingBottom="10dp"
android:paddingLeft="28dp"
android:paddingRight="28dp"
android:text="#string/cancel"
android:id="#+id/btn_cancel_signin"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cancel_done_btn"
android:layout_marginRight="30dp"
android:layout_marginTop="40dp"
android:textSize="17dp"
android:text="#string/done"
android:paddingTop="10dp"
android:textStyle="bold"
android:paddingBottom="10dp"
android:paddingLeft="35dp"
android:paddingRight="35dp"
android:layout_alignParentRight="true"
android:id="#+id/btn_done_signin"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:layout_marginLeft="40dp"
android:orientation="vertical"
android:layout_below="#+id/btn_cancel_signin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="times new roman"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Tuesday,May"
android:textSize="25dp"
android:textStyle="bold"
android:id="#+id/tv_day_month" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="times new roman"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=" 7,2016"
android:textSize="25dp"
android:textStyle="bold"
android:id="#+id/tv_date" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="200dp"
android:layout_marginLeft="130dp"
android:layout_below="#+id/btn_cancel_signin">
<ImageView
android:id="#+id/iv_signin_logo"
android:layout_width="200dp"
android:layout_height="180dp"
android:src="#drawable/sign_in_logo"
android:layout_marginTop="10dp" />
</LinearLayout>
<ScrollView
android:layout_width="350dp"
android:layout_height="wrap_content"
android:id="#+id/scroller_sign_in"
android:layout_below="#+id/btn_done_signin"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<LinearLayout
android:orientation="vertical"
android:paddingLeft="10dp"
android:layout_marginRight="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="30dp">
<TextView
android:layout_height="wrap_content"
android:text="First Name"
style="#style/sign_in_text"
android:id="#+id/label_firstname"
android:layout_alignParentLeft="true"
android:paddingTop="10dp"
android:inputType="textCapWords"
/>
<AutoCompleteTextView
android:id="#+id/et_firstname"
android:hint="Required"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
>
<TextView
android:layout_height="wrap_content"
android:text="Last Name"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_lastname"
android:paddingTop="10dp"
android:layout_alignParentLeft="true"
android:inputType="textCapWords"
/>
<AutoCompleteTextView
android:id="#+id/et_lastname"
android:hint="Required"
android:ems="10"
android:textSize="20dp"
android:textAllCaps="true"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_company"
>
<TextView
android:layout_height="wrap_content"
android:text="Company"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:layout_marginTop="10dp"
android:id="#+id/label_company"
android:layout_alignParentLeft="true"
/>
<AutoCompleteTextView
android:id="#+id/et_company"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:textAllCaps="true"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<!--android:background="#drawable/contact_edittext_bg"-->
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_address"
>
<TextView
android:layout_height="wrap_content"
android:text="Address"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_address"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_address"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_city"
>
<TextView
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:layout_height="wrap_content"
android:text="City"
android:id="#+id/label_city"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_city"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_state"
>
<AutoCompleteTextView
android:id="#+id/et_state"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
<TextView
android:layout_height="wrap_content"
android:text="State"
style="#style/sign_in_text"
android:id="#+id/label_state"
android:paddingTop="15dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_zip_code"
>
<TextView
android:layout_height="wrap_content"
android:text="Zip Code"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_zip_code"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_zipcode"
android:ems="10"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:textSize="20dp"
android:padding="10dp"
android:layout_height="wrap_content"
android:inputType="number"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
remove this from xml.
android:background="#drawable/back"
Write in your java file.
getWindow().setBackgroundDrawableResource(R.drawable.back);
Related
I am making a Speed Dial App, which has Emergency Numbers hard-coded in it. Using nested Relative Layout and made a list of numbers.
Below is the Emergency Numbers Page.
This is a Page of Dialer App, where it has a dialer and this is the Speed Dial Section Fragment which is not scrollable.
Below is my XML fragment for the above image.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:orientation="vertical">
<!-- Relative Layouts Emergency Numbers Here - Logic - Increment Nums by 1-->
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout2">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 1"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnPolisi"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout3"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout4"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView2"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 2"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnRS"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout5"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout6"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView3"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 3"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnFire"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout7"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout8"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView4"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 4"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnEmg4"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout9"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout10"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView5"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 5"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnEmg5"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout11"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout9"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout12"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView6"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 6"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnEmg6"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout13"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout11"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout14"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView7"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 7"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnEmg7"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
I have tried with the ListView inside the nested relative layout. And even the scrollview for the same, some were fatal when used. I may be using some absurd logic in this code, but the view is great for me, I just need this code to make the layout scrollable. Kindly let me know where I need to change in my code to make the page scrollable.//
When I posted this question few logical issues were there in my layouts, now I have framed it logically and it;s inside a Linear Layout.
It isnt working anyway.
<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="10dp"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
// Write here your whole code without writing first Relative Layout....
</RelativeLayout>
</ScrollView>
<RelativeLayout>
You need to put your layout inside a Scroll View. But a scroll view can have only ONE direct child. So what you need to do is take you top most relative layout and put that inside a scroll view. Something like this:
<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="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:layout_marginTop="10dp"
android:layout_below="#+id/relativeLayout4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout7">
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_below="#+id/textView5" >
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView3"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 3"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnFire"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout2">
<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_below="#+id/textView" >
<ImageView
android:id="#+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView2"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 1"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnPolisi"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:layout_marginTop="10dp"
android:layout_below="#+id/relativeLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout4">
<TextView
android:id="#+id/tvnew"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_below="#+id/tvnew" >
<ImageView
android:id="#+id/ivscreenshot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 2"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnRS"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout5"
android:layout_marginTop="12dp"
android:layout_below="#+id/relativeLayout7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/tvnew1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout6"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/tvnew1"
android:layout_alignStart="#+id/tvnew1">
<ImageView
android:id="#+id/ivscreenshot1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot1"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 4"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnEmg4"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout8"
android:layout_marginTop="16dp"
android:layout_below="#+id/relativeLayout5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/tvnew2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout10"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/tvnew2"
android:layout_alignStart="#+id/tvnew2">
<ImageView
android:id="#+id/ivscreenshot2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot1"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 5"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnEmg5"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout11"
android:layout_marginTop="14dp"
android:layout_below="#+id/relativeLayout8"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/tvnew3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout12"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/tvnew3"
android:layout_alignStart="#+id/tvnew3">
<ImageView
android:id="#+id/ivscreenshot3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot3"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 6"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnEmg6"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout13"
android:layout_marginTop="7dp"
android:layout_below="#+id/relativeLayout11"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/tvnew4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout14"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/tvnew4"
android:layout_alignStart="#+id/tvnew4">
<ImageView
android:id="#+id/ivscreenshot4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot4"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 7"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnEmg7"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
If you want to do with code:
ScrollView scrollview = new ScrollView(this);
scrollview.addView(wView);
Hey I have a ScrollView which allow users to input their credentials in the EditTexts inside. But there's one problem, one of the TextViews prior to its EditText consist of a Spinner but I do not know how to make that Spinner and the TextView side by side. Any help will be appreciated, thanks!:)
My xml:
<ScrollView
android:layout_width="344dp"
android:layout_height="495dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/textView39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Billing Address"
android:textSize="30dp" />
<TextView
android:id="#+id/textView38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="20dp"
android:text="First Name"
android:textSize="16dp" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:text="Last Name"
android:textSize="16dp" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView41"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:text="Street"
android:textSize="16dp" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPostalAddress" />
<TextView
android:id="#+id/textView42"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Country"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:textSize="16dp" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="50dp"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
Try this,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp"
android:layout_width="344dp"
android:layout_height="495dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/textView39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Billing Address"
android:textSize="30dp" />
<TextView
android:id="#+id/textView38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="20dp"
android:text="First Name"
android:textSize="16dp" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:text="Last Name"
android:textSize="16dp" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView41"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:text="Street"
android:textSize="16dp" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPostalAddress" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/textView42"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:text="Country"
android:textSize="16dp" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="50dp"
android:layout_marginLeft="30dp"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Use Linear Layout after Edittext3 as:
<!--Use dimensions of your choice-->
<LinearLayout
android:orientation="horizontal"
<!-- TO display in center use android:layout_gravity="center" -->
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/textView42"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Country"
android:layout_marginLeft="70dp"
android:textSize="16dp" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="50dp"
android:layout_marginLeft="10dp"
android:layout_height="wrap_content" />
</LinearLayout>
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 am stuck how to scroll layout when keyboard appear? this is my static page but when my keyboard appear then my scrollview is not working.i can not give hard code height of scrollview. please help me..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/settingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/splash_bg" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
</ScrollView>
Please help me out.
suggestions apreciated
Thanks Kind Regards.
Try this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/splash_bg" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
And add this code to ypur manifest project:
<activity
android:name="YourActivity"
android:windowSoftInputMode="stateVisible|stateAlwaysVisible" >
</activity>
add this code in ur manifest activty
android:windowSoftInputMode="adjustPan|stateAlwaysVisible"
this code useful for scrolling relative layout..
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="#+id/settingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/splash_bg" >
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/bottomRelay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="7.5dp"
android:background="#android:color/transparent"
android:visibility="gone" >
<TextView
android:id="#+id/Upload"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#ededed"
android:gravity="center"
android:text="Upload Photo"
android:textColor="#8F8F8F"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/Upload"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/choose_existing"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border1"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="1dp"
android:background="#ededed"
android:gravity="center"
android:text="Library"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/choose_existing"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/Camera"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border2"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="1dp"
android:background="#ededed"
android:gravity="center"
android:text="Camera"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/Camera"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/cancel"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border3"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="20dp"
android:background="#ededed"
android:gravity="center"
android:text="Cancel"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
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.