简体   繁体   English

Android ActionBar溢出菜单样式

[英]Android ActionBar overflow menu style

I've set up a simple menu with one position like this: 我设置了一个简单的菜单,其位置如下:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">

<item android:id="@+id/action_language" android:title="@string/language"
    android:orderInCategory="100" />
</menu>

using 运用

Theme.AppCompat.Light.DarkActionBar

style. 样式。 When I click the three dots the menu position appears instead of the icon, not below it? 当我单击三个点时,出现菜单位置而不是图标,而不是图标下方? Is there any way to make it appear under the icon, not 'on' it? 有什么办法可以使其显示在图标下方,而不是“显示在”图标下方?

Actually you can't do anything with this icon, but you can create menu item with android:actionLayout="@layout/custom_lauout" . 实际上,您无法使用此图标执行任何操作,但是可以使用android:actionLayout="@layout/custom_lauout"创建菜单项。 Then you can create Popup Window, which allows such positioning. 然后,您可以创建弹出窗口,该窗口可以进行此类定位。 In popupWindow you will show all items that must show under "three dots item". 在popupWindow中,您将显示必须显示在“三点项目”下的所有项目。

Here rea a few links which can help you: http://developer.android.com/reference/android/widget/PopupWindow.html https://stackoverflow.com/a/23516493/3864698 这里有一些可以帮助您的链接: http : //developer.android.com/reference/android/widget/PopupWindow.html https://stackoverflow.com/a/23516493/3864698

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM