1
有谁知道如何添加一个浮动条,它将停留在布局页面的顶部,即使用户滚动浏览布局的内容时也是如此?Android:布局中的浮动条
有谁知道如何添加一个浮动条,它将停留在布局页面的顶部,即使用户滚动浏览布局的内容时也是如此?Android:布局中的浮动条
只需在布局的顶部添加该栏,然后用ScrollView
包装其余内容即可。例如:
<?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>
这样一来,你的观点的包裹部分将滚动而头将保持在同一个站点。
甜,我会试试看,谢谢Cristian。 – dhulihan 2010-07-19 05:07:05
+1我需要类似的东西,但我需要底部的浮动弹出窗口,虽然起点不错! – AgentKnopf 2013-02-19 09:57:16