I'm using ViewAn开发者_如何转开发imator to switch between views...
my layout file is like this:
<ViewAnimator android:id="@+id/ViewFlipper01"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<!--adding views to ViewFlipper-->
<ExpandableListView android:id="@+id/List01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:text="Flipper Content 0"></ExpandableListView>
<ExpandableListView android:id="@+id/List02"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:text="Flipper Content 0"></ExpandableListView>
<TextView android:id="@+id/TextView02" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Flipper Content 2">
</TextView>
</ViewAnimator>
When I click on some of the children from the first expandable list I want to go directly to the third child.
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
viewAnimator.setDisplayedChild(2);
viewAnimator.showNext();
return true;
}
Nothing happens when I click...
If I use only viewAnimator.showNext();
I get to the second element...
I cannot find out why it is not working for me.
Can someone give me a clue?
Thanks!
Perhaps the problem was that the second child's index is actually 1 (ViewAnimator uses 0-based indexes).
精彩评论