是否有可能在ViewSwitcher中获取当前显示图像的名称/引用/id?
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;
}谢谢!
托比亚斯
发布于 2013-01-03 23:31:54
使用上面的“编辑”按钮对您的问题帖子进行更改。
至于你的问题,如果你正在使用ViewSwitcher,我认为你可以使用某种指示器来告诉你正在显示哪个屏幕(哪个ViewGroup)。比如调用切换命令时正在修改的int或boolean。
发布于 2013-03-26 16:30:59
在ViewSwitcher中,您只能使用at max 2 views (在您的情况下是图像)。
通过getCurrentView()方法获取当前视图
或者通过getDisplayedChild()方法获取当前可见项的索引,可以是0或1
https://stackoverflow.com/questions/14131366
复制相似问题