如何添加在Android上证溢出图标项 [英] How to add overflow icon items in a card in Android
问题描述
您好我想创建这样使用支持库<一个布局href=\"https://developer.android.com/reference/android/support/v7/widget/CardView.html\">https://developer.android.com/reference/android/support/v7/widget/CardView.html但我没有找到一个方法来添加一个卡溢出图标。
Hi I am trying to create a layout like this using support library https://developer.android.com/reference/android/support/v7/widget/CardView.html but i didn't found a way to add overflow icon in a card.
我不希望使用这个库<一个href=\"https://github.com/gabrielemariotti/cardslib/blob/master/doc/CARDGRID.md\">https://github.com/gabrielemariotti/cardslib/blob/master/doc/CARDGRID.md.我想用,谷歌最近推出的支持库做的一样。
I don't want to use this library https://github.com/gabrielemariotti/cardslib/blob/master/doc/CARDGRID.md. I want to do same using support library that Google introduced recently.
是不是有一种方式来实现使用支持库,或我必须使用gabrielemariotti库在卡片视图中添加溢出项目。
Isn't there is way to achieve using support library or I have to use gabrielemariotti library to add overflow items in a card view.
家伙,我已经编辑现在的问题是比较清楚的,我想要什么。
Guys I have edited question now it is more clear what i want.
推荐答案
首先您不应使用此lib中的只有实现溢出菜单里面卡
First of all you shouldn't use this lib only to achieve an overflow menu inside a card.
说,支持图书馆CardView是的的FrameLayout 的背后任何模型。
实现这一目标的最佳途径,现在是使用新的工具栏
的CardView布局中。
Said that,the CardView in support Library is a FrameLayout with any model behind.
The best way to achieve it, now is to use the new Toolbar
inside the CardView layout.
您也可以添加的ImageView
的 CardView
布局里面做这样的事情:
Also you can add a ImageView
inside the CardView
layout and do something like this:
PopupMenu popup = new PopupMenu(getContext(), mImageButton);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.your_menu, popup.getMenu());
最后(但它不是那么重要),如果它是不够的,新的cardslib(即将推出)将使用CardView的支持库。
Finally (but it is not so important) if it isn't enough, the new cardslib (coming soon) will use the CardView in support library.
这篇关于如何添加在Android上证溢出图标项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!