如何在overridePendingTransition
`适配器上插入GridView
?这种方式不起作用,没有转换启动功能完美的工作
bt.setOnLongClickListener(new OnLongClickListener(){
@Override
public boolean onLongClick(View v) {
final String selectedPad = Drum.pads[position];
Intent modPad = new Intent(v.getContext(), ModifyPad.class);
modPad.putExtra("pad", selectedPad);
context.startActivity(modPad);
overridePendingTransition(R.anim.exit_slid_in, R.anim.exit_slid_out);
return false;
}
});
我看过这篇文章:
android start Activity in adapter (transition animiation direction problem),评论相关,但我不知道如何通过Activity
中的Adapter
。有什么帮助吗?
答案 0 :(得分:23)
Context是Activity的基础对象(参见:What is the difference between Activity and Context?), 所以我使用了以下内容:
Activity activity = (Activity) mContext;
activity.startActivity(repinIntent);
activity.overridePendingTransition(R.anim.act_start_in_from_right, R.anim.act_start_out_to_left);