ListView和滚动型 [英] listView and ScrollView
问题描述
我有3 ImageView的和垂直orientation.i一个ListView中的LinearLayout要滚动的全屏包括图像,当用户滚动list.is这可能吗?谢谢
< XML版本=1.0编码=UTF-8&GT?;
<滚动型的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:后台=#222222
机器人:方向=垂直>
< ImageView的
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=@可绘制/ PH2/>
< ImageView的
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=@可绘制/ PH1/>
< ImageView的
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=@可绘制/ PH2/>
<的ListView
机器人:ID =@ + ID / ll4_list
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:layout_weight =0.5
机器人:cacheColorHint =#00000000/>
< /滚动型>
您肯定不希望把ListView控件的滚动型里面,但它肯定可以包括图像。我会建议考虑将与图像的布局在包头到ListView。请参阅<一href="http://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View,%20java.lang.Object,%20boolean%29"相对=nofollow> addHeaderView 。这 SO帖子相关的也可能是你有帮助。
I have a linearlayout with 3 imageView and a listview in vertical orientation.i want to scroll the full screen including the images when the user scrolls the list.is that possible?thanks
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#222222"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ph2" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ph1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ph2" />
<ListView
android:id="@+id/ll4_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:cacheColorHint="#00000000" />
</ScrollView>
You definitely don't want to put the ListView inside of the ScrollView, but it's certainly possible to include the images. I would recommend considering putting the layout with the images in a header to the ListView. See addHeaderView. This related SO post may also be of use to you.
这篇关于ListView和滚动型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!