1

私は、ヘッダー、タイトル、Imageview、および Webview を含む Scrollview を持つ単純な Android レイアウトを持っています。私の問題は、webview のコンテンツが画面を超えている場合、自動的にスクロールする webview が上からではなくヘッダーの下からスクロールする必要があることです。xml の疑似コードをここに配置しました。ヘッダー レイアウトの下からスクロールを開始するにはどうすればよいか教えてください。

<RelativeLayout> id - MainLayout </RelativeLayout>
<RelativeLayout> id - HeaderLayout </RelativeLayout>
<ScrollView> id - scrollLayout 
android:below - HeaderLayout 
<TextView> To display title </TextView>
<ImageView> To display a image </ImageView>
<WebView> To display a web content </WebView>
</Scrollview>

これまでのところ、ヘッダーレイアウトに alignParentTop を使用し、Scrollview と webview に alignParentBottom を使用しようとしましたが、成功しませんでした。私を助けてください。

編集:私のXML

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

<RelativeLayout
    android:id="@+id/header"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:layout_alignParentTop="true" >

    <Button
        android:id="@+id/back_btn"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="10dp"
        />

    <ImageView
        android:id="@+id/logo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" />

    <Button
        android:id="@+id/back"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="40dp"
         />

    <Button
        android:id="@+id/forward"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        />
</RelativeLayout>

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_below="@+id/header"
    android:layout_marginBottom="10dp"
    android:layout_marginTop="10dp" >

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

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:lineSpacingExtra="5dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:textColor="@android:color/black"
            android:textSize="15sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="18dp"
            android:ellipsize="none"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:singleLine="true"
            android:textColor="@android:color/black"
            android:textSize="12sp" />

        <ImageView
            android:id="@+id/image"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="15dp"
            android:layout_marginTop="13dp"
            android:visibility="gone" />

        <WebView
            android:id="@+id/webview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right|center_horizontal"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp" />
    </LinearLayout>
</ScrollView>

<ProgressBar
    android:id="@+id/progress"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:textStyle="bold"
    android:visibility="gone" />

4

0 に答える 0