문제

is there a possibility to get the name/reference/id of the current displayed image in a ViewSwitcher?

switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher);

[...]

@Override
public boolean onSingleTapUp(MotionEvent e) {
       Log.d(TAG, "tell me please, how to get the name/reference/id/etc of the currently displayed image, so i can start a specific action relating to the current image");
       return false;
}

Thanks!

Tobias

도움이 되었습니까?

해결책 2

Use the 'edit' button above to make changes to your question post.

As for your question, if you're using a ViewSwitcher, I think you can do with some sort of indicator to tell you which screen (which ViewGroup) is being displayed. Like an int or boolean that you're modifying when switch commands are called.

다른 팁

In ViewSwitcher you can only have at max 2 views (Which are images in your case).

To get current view by getCurrentView() method

Or to get the index of current visible item by getDisplayedChild() method, which can be either 0 or 1

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top