大佬教程收集整理的这篇文章主要介绍了android – 单击设置图标时创建新活动,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@Override public Boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main,menu); return true; } @Override public Boolean onOptionsItemSELEcted(MenuItem item) { switch (item.getItemId()) { case R.id.search: Intent intent = new Intent(this,SetTingsActivity.class); // intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOp); startActivity(intent); return true; default: return super.onOptionsItemSELEcted(item); } }@H_281_5@main.xml中:
<menu xmlns:android="http://scheR_431_11845@as.android.com/apk/res/android" xmlns:app="http://scheR_431_11845@as.android.com/apk/res-auto" xmlns:tools="http://scheR_431_11845@as.android.com/tools" > <item android:id="@+id/search" android:icon="@drawable/ic_action_setTings" android@R_22_6964@="@String/search"/> </menu>
如果我点击该图标,则必须创建新活动.但它显示弹出窗口搜索.我不需要弹出窗口.只需单击设置图标就可以移动到新活动.到目前为止我做了这样的代码.
以上是大佬教程为你收集整理的android – 单击设置图标时创建新活动全部内容,希望文章能够帮你解决android – 单击设置图标时创建新活动所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。