在列表视图最大化可见行 [英] Maximize visible rows in a listview
问题描述
这是我的$ C $下列表中的项目..假设IM夸大这个TextView的进入列表视图
Heres my code for items in a list.. suppose im inflating this textview into the listview
<TextView
android:id="@+id/textviewItemList"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:paddingBottom="10dip"
android:paddingLeft="10dip"
android:paddingTop="10dip"
android:textSize="35px" />
和这里是我的$ C $下列表视图。仅有3行的RelativeLayout的内部与其他可滚动可见。 RelativeLayout的具有文本视图的高度X3的高度......
And here is my code for list view. inside a relativelayout having only 3 rows are visible with others as scrollable. relativelayout having height of x3 of the height of text view...
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_marginTop="15px"
android:background="@drawable/border"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<ListView
android:id="@+id/listview_data"
android:layout_width="300px"
android:layout_height="wrap_content"
android:columnWidth="30px"
android:gravity="center"
android:numColumns="10">
</ListView>
</RelativeLayout>
但是,当列表视图中有超过3项创建的,我得到小号滚动时下跌阴影部分或向上,但它并没有突出所有的(它有某种阴影部分或者我说的衰减部分)...
but when the listview is created with more than 3 items, i get s shadow part when scrolling down or up, it didn't highlight all (it has some kind of shadow part or i say fading part)...
推荐答案
添加机器人:cacheColorHint =#00000000在你的列表视图。这里是你的code第二段重写cacheColorHint:
Add android:cacheColorHint="#00000000" in your listview. Here's the second segment of your code rewritten with cacheColorHint:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_marginTop="15px"
android:background="@drawable/border"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<ListView
android:id="@+id/listview_data"
android:layout_width="300px"
android:layout_height="wrap_content"
android:columnWidth="30px"
android:gravity="center"
android:numColumns="10"
android:cacheColorHint="#00000000" >
</ListView>
</RelativeLayout>
它消除了阴影/把你的ListView的黑屏问题。
It removes the shadow/turning the screen black problem of your listview.
这篇关于在列表视图最大化可见行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!