Back to project page u2020.
The source code is released under:
Apache License
If you think the Android project u2020 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jakewharton.u2020.ui.misc; // w w w.j a v a2s .c o m import android.content.Context; import android.util.AttributeSet; import android.widget.ViewAnimator; public class BetterViewAnimator extends ViewAnimator { public BetterViewAnimator(Context context, AttributeSet attrs) { super(context, attrs); } public void setDisplayedChildId(int id) { if (getDisplayedChildId() == id) { return; } for (int i = 0, count = getChildCount(); i < count; i++) { if (getChildAt(i).getId() == id) { setDisplayedChild(i); return; } } throw new IllegalArgumentException("No view with ID " + id); } public int getDisplayedChildId() { return getChildAt(getDisplayedChild()).getId(); } }