shyam
shyam

Reputation: 1306

set scroll on whole layout android

hi i have a xml file in which i set a background image for whole layout then after that i put 2 text boxt and one button image.but when i typing on edit box softkeyboard hides the button image for submmit the data ,so i want to set the scrool for whole lay out but when i set the scroll it only scroll back ground image not the whole layout so all ui is distorting so how to make scroolable whole layout my xml is below pls modify on my code

thanks

  <?xml version="1.0" encoding="utf-8"?>
  <RelativeLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:background="@drawable/user_id_bg2" >
  <EditText 
  android:inputType="text|textNoSuggestions"

 android:text="" 
 android:id="@+id/editText1" 
 android:singleLine="true"
 android:hint="Enter Your User Id"
 android:layout_marginTop="85dip"
 android:layout_marginLeft="20dip"
 android:layout_marginRight="20dip"   
 android:layout_height="40dip"
 android:layout_width="fill_parent">
 </EditText>
 <EditText 
 android:inputType="text|textNoSuggestions"
 android:password="true"
 android:singleLine="true"
 android:hint="Enter Your Password"
 android:layout_marginTop="125dip"
 android:layout_marginLeft="20dip"
 android:layout_marginRight="20dip"  
 android:id="@+id/editText2" 
 android:imeOptions="actionDone"
 android:layout_height="40dip"
 android:layout_width="fill_parent"/>
 <ImageView 
 android:id="@+id/buttonimg"
 android:layout_below="@id/editText2"
 android:layout_marginLeft="237dip"
 android:layout_width="wrap_content"
 android:layout_height="40dip"
 android:background="@drawable/go_button"
 />

Upvotes: 0

Views: 1752

Answers (1)

Martyn
Martyn

Reputation: 16622

Can you not put everything inside a ScrollView ?

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"">
    <RelativeLayout 
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:background="@drawable/user_id_bg2" >
 ...

Upvotes: 1

Related Questions