检测操作栏中的图标长preSS [英] Detecting action bar icon long press
本文介绍了检测操作栏中的图标长preSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要检测在Android应用程序中的动作条应用程序的图标长preSS。这可能吗?
I want to detect long press on application's icon in the ActionBar in Android application. Is it possible?
推荐答案
添加自定义视图操作栏
View view = getLayoutInflater().inflate(R.layout.actionbar,null);
btnClose = (ImageView) view.findViewById(R.id.btnClose);
btnClose.setOnLongClickListener(new OnLongClickListener()
{
@Override
public boolean onLongClick(View v) {
Log.d("rvg", "Long click:");
return false;
}
});
getSupportActionBar() . setCustomView(view);
这篇关于检测操作栏中的图标长preSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文