0

I have a view TextViews and a WebView which I want to scull as a unit, instead of the WebView scrolling when required because of the content length. This is probably something simple, but I don't seem to be able to get it to work, as at all times the WebView has a scrollbar.

This is my Layout file:

<ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/imageView"
        android:src="@drawable/background_tablet"
        android:scaleType="centerCrop"
    android:contentDescription="@string/background_image" />

<LinearLayout
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/list_background_overlay">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:background="@color/list_background_overlay"
        android:baselineAligned="false">

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="@string/author"
            android:id="@+id/article_view_author"
            />

    <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="@string/title"
            android:id="@+id/article_titleView" android:layout_gravity="center_horizontal"
            android:gravity="center_horizontal"/>

    <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            >

        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="@string/site"
                android:id="@+id/article_view_site"/>

        <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="@string/date_unknown"
                android:id="@+id/article_view_date"
                android:gravity="right"/>
    </LinearLayout>
</LinearLayout>

    <RelativeLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="70dp"
            android:background="@color/list_background_overlay"
            android:id="@+id/article_mediaLayout"
            android:padding="10dp"
            >

        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="@string/duration_default"
                android:id="@+id/article_duration"
                android:gravity="left"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                />

        <Button
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/play"
                android:id="@+id/article_playBttn"
                android:layout_alignTop="@+id/article_preview"
                android:layout_centerInParent="true"/>

        <ImageView
                android:layout_width="100dp"
                android:layout_height="50dp"
                android:id="@+id/article_preview"
                android:layout_gravity="center"
                android:layout_centerVertical="true"
                android:layout_alignParentRight="true"
                android:paddingRight="20dp"
            android:contentDescription="@string/preview_image" />

        <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="512dp"
                android:layout_alignParentTop="true"
                android:layout_marginTop="10dp"
                android:id="@+id/relativeLayout">
        </RelativeLayout>
    </RelativeLayout>

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="15dp"
        android:id="@+id/article_filler">
</FrameLayout>

<FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/list_background_overlay"
        android:paddingTop="20dp"
        android:paddingBottom="20dp">

    <WebView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/article_contentView" android:layout_gravity="center_horizontal"
            android:padding="10dp"
            android:paddingTop="30dp"
            android:paddingBottom="20dp"/>
</FrameLayout>

Luuk D. Jansen
  • 4,402
  • 8
  • 47
  • 90

1 Answers1

0

Webview has a internal scroller. Because of that it's not a good option to wrap it in another scrollview. I don't know how complex your HTML is or whether it's a choice in your case anyway, but maybe you should think about to show it in a pure textview as discussed here: How to display HTML in TextView?

Community
  • 1
  • 1
A.D.
  • 1,412
  • 2
  • 19
  • 37
  • 1
    It is basically HTML form RSS feeds, so can include everything from images to css. The TextView wouldn't be suitable I think having toyed around a bit. Is there a way to know the hight of the WebView, so I can update the height of the WebView frame – Luuk D. Jansen Feb 15 '14 at 15:35