布局预览未显示操作栏溢出选项

时间:2016-09-07 09:33:14

标签: android

我在这里遇到一个小问题,其中ActionBar的溢出选项显示在模拟器中但不显示在布局预览中。我目前正在使用Android Studio v 2.1.3。

还有其他人遇到同样的问题吗?

布局预览

enter image description here

模拟器屏幕截图

enter image description here

2 个答案:

答案 0 :(得分:0)

尝试在布局

中向根视图添加tools:menu
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:menu="menu1,menu2" />

更多信息: http://tools.android.com/tech-docs/tools-attributes

答案 1 :(得分:0)

根据docs

  

工具:菜单

     

旨在:任何根Login(LoginInputModel model, string button)

     

此属性指定布局预览应显示在哪个菜单中   应用栏。该值可以是一个或多个菜单ID,中间用   逗号(不带@ menu /或任何此类ID前缀,不带.xml   扩展名)。

但是,我发现它仅在以下情况下有效:

  1. 该属性直接添加到<View>小部件
  2. 该值包括Toolbar前缀
@menu/
相关问题