我正在尝试在github中使用 bherbst 的FragmentTransition库: FragmentTransitionSample
但是我希望转换结束时 DetailFragment 中的图像不可见,所以我在 GridFragment 中监听此事件并将图像设置为不可见:
@Override
public void onKittenClicked(KittenViewHolder holder, int position) {
int kittenNumber = (position % 6) + 1;
kittenDetails = DetailsFragment.newInstance(kittenNumber);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mDetailsTransition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
kittenDetails.invisibleView();
Toast.makeText(getActivity(), "Hello===========>", Toast.LENGTH_SHORT).show();
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
}
在 DetailFragment :
中public void invisibleView() {
image.setVisibility(View.INVISIBLE);
}
单击第1个网格时,此图像仅不可见。请问有什么想法吗?