[英]implementing list views android
我需要在android中实现此布局。视图必须是两个共享30-70%屏幕空间的列表视图。右侧列表必须水平滚动和垂直...左侧列表必须只能在垂直方向上滚动...并且当向上或向下滚动任一列表时,每个列表项(记录)必须在同一行中。 我尝试过以这种方式实现,但效果很好,但滚动时却不够平滑……而且大多数情况下屏幕会变黑。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:orientation="horizontal">
<ListView android:id="@+id\lV1" android:layout_width="100dp"
android:layout_height="wrap_content" />
<HorizontalScrollView android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ListView android:id="@+id/lV2" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</HorizontalScrollView>
</LinearLayout>
</LinearLayout>
请注意,整个布局都需要显示在选项卡视图中。我将布局更改为该布局,但效果仍然不理想
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_width="fill_parent" android:fillViewport="true"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout android:layout_width="match_parent"
android:layout_height="fill_parent" >
<ListView android:id="@+id/lV1" android:layout_width="100px"
android:layout_height="wrap_content" android:background="@color/white"
android:fadingEdge="vertical" android:cacheColorHint="#00000000"
android:fastScrollEnabled="true" />
<HorizontalScrollView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_toRightOf="@id/listView1">
<ListView android:id="@+id/lV2" android:layout_width="wrap_content"
android:fastScrollEnabled="true" android:layout_height="wrap_content"
android:background="@color/white" android:cacheColorHint="#00000000"
android:layout_toRightOf="@id/lV1" />
</HorizontalScrollView>
</RelativeLayout>
</ScrollView>
将android:cacheColorHint="#00000000"
到您的listview应该可以防止黑名单
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.