大佬教程收集整理的这篇文章主要介绍了Android Action Bar三点不显示,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://scheR_302_11845@as.android.com/apk/res/android" xmlns:yourapp="http://scheR_302_11845@as.android.com/apk/res-auto" > <item android:id="@id/search" android:icon="@drawable/search" android@R_922_6964@="@String/search" yourapp:showAsAction="ifRoom" /> <item android:id="@id/view_all" android@R_922_6964@="@String/view_all" yourapp:showAsAction="never"/> <item android:id="@+id/action_setTings" yourapp:showAsAction="never" android@R_922_6964@="@String/action_setTings"/>
现在我该怎么做,将action_setTings放入三个点(动作栏),而不是硬件菜单按钮(没有任何黑客).
主要活动
@Override public Boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if @R_801_8913@ present. getMenuInflater().inflate(R.menu.main_activity_actions,menu); return true; }
好吧,我找到了黑客,但如果有任何其他方式然后让我知道,
劈
将此代码放在onCreate中
try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPeRMANentMenuKey"); if(menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config,falsE); } } catch (Exception eX) { // Ignore }
为此,您需要导入
import java.lang.reflect.Field; import android.view.ViewConfiguration;
以上是大佬教程为你收集整理的Android Action Bar三点不显示全部内容,希望文章能够帮你解决Android Action Bar三点不显示所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。