Rahul Sharma
Rahul Sharma

Reputation: 3677

Scroll issue in android

In my application i have an activity which has the following layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:background="@color/white">
    <WebView android:id="@+id/detail_title" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium"
        android:padding="2dp" android:textColor="@android:color/black"
        android:background="@android:color/white" />
    <WebView android:id="@+id/detail_subtitle" android:orientation="vertical"
        android:layout_width="match_parent" android:layout_height="wrap_content"
        android:padding="2dp" android:background="@android:color/white" />
    <WebView android:id="@+id/wv3" android:orientation="vertical"
        android:layout_height="fill_parent" android:layout_width="fill_parent" 
        android:background="@android:color/white" />
</LinearLayout>

wv3 has a lot of html text which appears properly but the problem is that i am getting scroll only in wv3 and the rest of the layout remains static which is quite irritating. i want that the whole of the layout has scroll and not only wv3.

Upvotes: 0

Views: 227

Answers (1)

blessanm86
blessanm86

Reputation: 31779

Modifiy your layout like 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="match_parent">
    <LinearLayout android:orientation="vertical" android:layout_width="match_parent"         
        android:layout_height="wrap_content">
        <WebView android:layout_width="match_parent" android:layout_height="200dip"
            android:id="@+id/wv1"/>
        <WebView android:layout_width="match_parent" android:layout_height="200dip"
            android:id="@+id/wv2"/>
        <WebView android:layout_width="match_parent" android:layout_height="500dip"
            android:id="@+id/wv3"/>    
    </LinearLayout>
</ScrollView>

Upvotes: 2

Related Questions