开发者

Scroll issue in android

开发者 https://www.devze.com 2023-03-27 14:38 出处:网络
In my application i have an activity which has the following layout <?xml version=\"1.0\" encoding=\"utf-8\"?>

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.


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消