开发者

ListeView inside a ViewFlipper

I have nested 2 ListView widgets inside a ViewFlipper:

<ViewFlipper android:id="@+id/flipper" android:layout_height="fill_parent" android:layout_width="fill_parent">
   <ListVie开发者_StackOverfloww android:id="@+id/bikeListView" android:layout_height="wrap_content" android:layout_width="fill_parent" />
   <ListView android:id="@+id/bikeComponentsListView" android:layout_height="wrap_content" android:layout_width="fill_parent" />
</ViewFlipper> 

I put a log at getView() method at my custom ListAdapter classes for the 2 ListView widgets and I discovered that when I move to next or previous view in ViewFlipper getView it is called even if ListView is not visible. For example, when I move from first ListView to the second one, getView() for the first one is called, although the second ListView is displayed.

Is this the expected behaviour? My intention is to use ViewFlipper and onFling to move back and forth in ViewFlipper and add many ListView inside ViewFlipper programmatically.

Thanks for reading my question.


I ran into the same issue and found that it's because your layout_height is set to wrap_content....see this post for more info:

http://www.anddev.org/view-layout-resource-problems-f27/multiple-calls-of-getview-in-arrayadapter-t16595.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜