sup*_*eee 8 android android-layout android-listview
我有兴趣创建一个由透明标题组成的屏幕和一个滚动标题后面的列表视图.我有一个缺点; FAST滚动条也在标题下方绘制.
出于某种原因,fastscrollbar似乎不尊重应用于列表视图的scrollbarStyle.您将在下图中注意到,普通滚动条工作正常,但powerscroll条位于透明标题后面.
不幸的是,我使用的列表视图通常会有数百个项目,因此快速滚动条是必需的.有没有办法设置未记录的"fastscrollStyle"?我对任何建议持开放态度!谢谢.
这是用于参考的布局XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="@+id/myListView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clipToPadding="false"
android:fastScrollEnabled="true"
android:scrollbars="vertical"
android:scrollbarStyle="insideOverlay"
android:paddingTop="50dp"/>
<TextView android:text="My Header"
android:gravity="center"
android:background="#8fff0000"
android:layout_width="fill_parent"
android:layout_height="50dp"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这已在KitK的KitKat中修复,但GridView似乎仍然出现此问题.谷歌?
小智 1
最好的解决方案是将列表视图与其他布局分开,其中主要相对布局视图是父级,其他布局是子级。
前任。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id"@+id/layoutHeader"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true">
<TextView android:text="My Header"
android:gravity="center"
android:background="#8fff0000"
android:layout_width="fill_parent"
android:layout_height="50dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="+id/layoutHeader">
<ListView
android:id="@+id/myListView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clipToPadding="false"
android:fastScrollEnabled="true"
android:scrollbars="vertical"
android:scrollbarStyle="insideOverlay"
android:paddingTop="50dp"/>
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1830 次 |
最近记录: |