-1

i want to scroll the layout till the bottom when the keypad is up. I wrote the code as below but i can't understand why its not working . Can any one please tell me the fault in that code.

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#FFFCE8"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<RelativeLayout 
    android:id="@+id/top" 
    android:layout_height="50dp" 
    android:background="#82552e"
    android:layout_width="fill_parent"
    android:layout_alignParentTop="true"
    >
    <TextView 
    android:text="Add Text"  
    android:textColor="#ffffff"
    android:textSize="20dp" 
    android:typeface="serif"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    />         
    </RelativeLayout>


<ScrollView    
android:layout_below="@+id/top"  
android:layout_above="@+id/bottom"  
android:layout_width="match_parent"
android:layout_height="wrap_content"   
>   
<LinearLayout     
android:orientation="vertical"    
android:layout_width="fill_parent"
android:layout_height="wrap_content"        
> 

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
>    
<EditText
android:id="@+id/edit"
android:gravity="top" 
android:layout_width="fill_parent"
android:layout_height="150dp"    
/>
</RelativeLayout>

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
>    
<Button 
android:id="@+id/add"    
android:text="Add"
android:textSize="18dp"
android:typeface="serif"
android:textColor="#ffffff"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="@drawable/item_back"
/>
</RelativeLayout>

</LinearLayout>


</ScrollView>  



</RelativeLayout>

Thanks in advance.

surendra
  • 2,217
  • 7
  • 34
  • 42

1 Answers1

0

Use This....

 android:scrollbars="vertical"

in your ScrollView

Abhishek Patel
  • 4,280
  • 1
  • 24
  • 38