Android的工作室 - 只是无法行动吧/溢出的工作?行动、工作室、工作、Android

2023-09-12 21:45:12 作者:风悠婉

我使用的是Android工作室(实际上是在Mac),只能用实际的设备

I'm using Android Studio (actually on Mac), only using real devices

这是唯一4.1+。所有项目都以新鲜的创建。

This is 4.1+ only. All projects created from fresh.

查看 - 我没有负载的支持和appcompat,作为最好的,我能理解摇篮。 [A]

CHECK - I did load support and appcompat, as best as I can understand Gradle. [A]

查看 - onCreateOptionsMenu等,看起来很不错...

CHECK - onCreateOptionsMenu, etc, looks good...

查看 - XML是好去。 (我不完全理解的showAsAction选项,并尝试所有。)[B]用文字或图标至于,我尝试了所有的排列。

CHECK - xml is good to go. (I do totally understand the showAsAction options, and tried them all.) [B] Regarding using text or an icon, I tried all permutations.

所以会发生什么?

在我的设备上运行(10+测试)。它只是显示尽可能多的操作栏项目,如能适应(例如,5左右)。旋转等完美的作品。

When I run it on a device (10+ tested). It simply shows as many action bar items as can fit (say, 5 or so). Rotation etc. works perfectly.

但它只是将不显示溢图标! WTF?它根本不显示,在任何地方,缺少的三个或四个项目。

But it just will not show the overflow icon!! WTF?? It simply does not show, anywhere, the missing three or four items.

我已经试过这一切既空活动和全屏活动。无论我做什么,它不会显示在@#$ @溢出。

I have tried all this with both "Blank Activity" and "Fullscreen Activity". No matter WHAT I do, it won't show the @#$@ overflow.

这几乎就像图标仅仅是在构建什么?

It's almost like the icon is just not available in the build or something??

可以在任何Android的朋友通灵这个问题?这是一个真正的跆拳道的时刻。先谢谢了。

Can any Android friends psychic this problem? It's a really "WTF" moment. Thanks in advance.

我的解决办法...... http://stackoverflow.com/a/22855136/294884 的伟大工程,但你的Andr​​oid你们会笑我这样做。

My workaround ... http://stackoverflow.com/a/22855136/294884 That works great, but you Android guys would laugh at me doing that.

[A]:(注意,我有两个build.gradle文件,我做了它的内层内的应用程序/会在外层无法正常工作)的

[B]:(注意,一个常见的​​问题似乎是,当人们不明白之间的'永远'和'ifRoomTBC,是不是我的问题在所有的区别:我的问题是@ $ @#溢出根本不会出现!)的

BTW任何人新到Android ...

BTW for anyone new to Android ...

http://stackoverflow.com/a/16046189/294884

这是广泛的讨论可能是非常有用的。

that extended discussion may be very useful.

推荐答案

这将是我最好的客人。硬件按钮的设备不显示3点菜单

That will be my best guest. Devices with hardware button don't show the 3-dots menu.

另外,如果该项目是4.1+你不需要也不支持-V4也appcompat-V7。这些可能会导致一些冲突。

Also if the project is 4.1+ you don't need neither support-v4 nor appcompat-v7. Those might be causing some conflict.

链接到不同设备上的按钮,谷歌的解释: http://developer.android.com/design/patterns/compatibility.html

Link to Google explanation on buttons on different devices: http://developer.android.com/design/patterns/compatibility.html

使用build.gradle文件或对话框,那么,也许是的,但我已经习惯了摇篮文件,甚至从来没有看对话框,而我只是老同学关于

Regarding using the build.gradle file or the dialog, well, probably yes, but I'm already used to the gradle file and never even look at the dialog, but I'm just old school.

结果!

发现肮脏的黑客强制溢出图标上,因为他们的硬件菜单按钮,设备可见。

Found Dirty Hack to force the overflow icon to be visible on devices which have the hardware menu button.

私人无效getOverflowMenu(){

private void getOverflowMenu() {

 try {
    ViewConfiguration config = ViewConfiguration.get(this);
    Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
    if(menuKeyField != null) {
        menuKeyField.setAccessible(true);
        menuKeyField.setBoolean(config, false);
    }
} catch (Exception e) {
    e.printStackTrace();
}

}

来源: http://www.tagwith.com/ question_264107_overflow菜单 - 不显示,在行动吧