This question already has an answer here:
这个问题已经有了答案:
- Popup Menu in custom ListView 7 answers
- 在custom ListView 7答案中弹出菜单。
I have a button that is in a fragment. When I click the button, It should show a popup menu. But It doens't.
我有一个在片段中的按钮。当我点击按钮时,它应该显示一个弹出菜单。但是它多恩。
These are my error messages :
这些是我的错误信息:
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.ias.caniasandroid, PID: 22823 java.lang.RuntimeException: Failed to resolve attribute at index 6 at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:603) at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:6473) at android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:6641) at android.widget.FrameLayout$LayoutParams.(FrameLayout.java:741) at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:685) at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:62) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at android.support.v7.view.menu.MenuPopupHelper$MenuAdapter.getView(MenuPopupHelper.java:374) at android.support.v7.view.menu.MenuPopupHelper.measureContentWidth(MenuPopupHelper.java:223) at android.support.v7.view.menu.MenuPopupHelper.tryShow(MenuPopupHelper.java:157) at android.support.v7.view.menu.MenuPopupHelper.show(MenuPopupHelper.java:129) at android.support.v7.widget.PopupMenu.show(PopupMenu.java:216)
E/AndroidRuntime:致命例外:主要流程:caniasandroid PID:22823 . lang。RuntimeException:在android.view.ViewGroup$LayoutParams. setbaseattributes (ViewGroup.java:6473)中,android.viewgroup $LayoutParams.(ViewGroup.java:6641),在android.widget. framelayoutparams (FrameLayout.java:741),在android.wiget.comelayoutparams .(framelayoutparams)。在android.view. layoutinflater.(LayoutInflater.java:492)中,在android.support.support.v7.view.menupopuphelper $ menuadapterview (MenuPopupHelper.java:374)在android. support.v7.view.menupopuphelper. tryshow (MenuPopupHelper.java:157)在android.support.v7.view.menu. menupopuphelper.org/。android.support.v7.widget.PopupMenu.show(PopupMenu.java:216)
My menu XML file:
我的菜单XML文件:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/login_menu_new_item"
android:orderInCategory="100"
android:title="@string/new_ias"
app:showAsAction="ifRoom|withText" />
<item
android:id="@+id/login_menu_edit_item"
android:orderInCategory="100"
android:title="@string/edit"
app:showAsAction="ifRoom|withText" />
<item
android:id="@+id/login_menu_delete_item"
android:orderInCategory="100"
android:title="@string/delete"
app:showAsAction="ifRoom|withText" />
</menu>
How can I solve this problem ?
我该如何解决这个问题?
1 个解决方案
#1
-1
It might be for too many style.css file.
它可能有太多的风格。css文件。
Add below in build.gradle file:
添加下面的构建。gradle文件:
compile 'com.android.support:design:22.2.0'
#1
-1
It might be for too many style.css file.
它可能有太多的风格。css文件。
Add below in build.gradle file:
添加下面的构建。gradle文件:
compile 'com.android.support:design:22.2.0'