2

Mylayoutは、ScrollViewすべてを保持する a で構成されます。ある時点で、ScrollView の上 (上) のView画面の下部にを表示する必要があります(したがって、 の後ろに移動します)。これにより、デバイスの画面の下部に貼り付けられたまま、画面を上下にスクロールできます。そのようなことをする方法についてみんなにアドバイスしてください。ありがとうございました。ScrollViewViewViewlayout

4

3 に答える 3

4

スクロールビューをビューの後ろに移動したい場合、これは次のように行うことができます:

(このSOの質問からの部分的なコードコピー)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:id="@+id/RelativeLayout1">

        <ScrollView android:id="@+id/scrollView"  
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
        </ScrollView>

        <View android:id="@+id/bottomView" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true"
            android:visibility="gone">>
        </View>
</RelativeLayout>

scrollview が View 要素を超えて展開されるようになりました。

于 2012-11-29T15:24:06.603 に答える
1

2つのフラグメントを作成し、weight属性を使用してスペースを分散させることができます。上部のフラグメントはルートscrolViewをホストし、下部のフラグメントはビューを持ちます。

于 2012-11-29T15:23:58.587 に答える
0

わかりました 2 つのオプション、最初の 1 つ:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<View
    android:id="@+id/myView"
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:layout_alignParentBottom="true" />

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@id/myView" />

</RelativeLayout>

このようにして、あなたScrollViewは常にあなたの上にありますView。しかし、ビューがあなたのSV. したがって、このコードを確認してください:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

 <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>

 <View
    android:id="@+id/myView"
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:layout_alignParentBottom="true" />

</RelativeLayout>
于 2012-11-29T15:43:39.447 に答える