Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:布局中的浮动条_Android - Fatal编程技术网

Android:布局中的浮动条

Android:布局中的浮动条,android,Android,有人知道如何添加一个浮动条,即使用户滚动浏览版面的内容,它也会停留在版面页面的顶部吗 只需将该条添加到布局顶部,并使用滚动视图包装其余内容即可。例如: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_wid

有人知道如何添加一个浮动条,即使用户滚动浏览版面的内容,它也会停留在版面页面的顶部吗

只需将该条添加到布局顶部,并使用
滚动视图
包装其余内容即可。例如:

<?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">
    <!-- Header -->
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Your header"/>

    <!-- rest of your layout -->
    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_content">
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Foo"/>
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Bar"/>
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Baz"/>
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="etc"/>
        </ScrollView>
</LinearLayout>


这样,视图的包装部分将可滚动,而标题将保留在同一站点中。

+1我需要类似的内容,但我需要底部的浮动弹出窗口,这是一个很好的起点!