Skip to content Skip to sidebar Skip to footer

Relativelayout Scrollview

I have an app with a few textboxes and editboxes. The app is working fine but when I am trying to add the scrollview element to see the lower part of app the application is forcibl

Solution 1:

Use the following format of layout

<ScrollView><RelativeLayout> 
               // Use textviews used above here
    </RelativeLayout></ScrollView>

Solution 2:

A scrollview can, as far as i know, only have 1 child. So you need to put all your Views in a LinearLayout or something, and add that to the scrollview.

from http://developer.android.com/reference/android/widget/ScrollView.html

A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a vertical orientation, presenting a vertical array of top-level items that the user can scroll through.

Solution 3:

You must define empty textview...

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/background"
    android:id="@+id/back"
    android:paddingRight="10dp"
    tools:context=".TaxActivity" >

<TextView
    android:id="@+id/tv1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

<ScrollView 
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/tv1" >
,...

Post a Comment for "Relativelayout Scrollview"