android中cardview内有三个点的小部件的名称是什么? [英] What's the name of the little widget with three dots inside a cardview in android?

查看:190
本文介绍了android中cardview内有三个点的小部件的名称是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



三点小小工具是什么?如何将它添加到我的应用程序?

解决方案

这不是一个小部件。它是一个 ImageButton (使用包含一个 PopupMenu

$ b $的溢出图标b

有关文档教程访问,请访问 http:// developer .android.com / guide / topics / ui / menus.html#PopupMenu



这指的是上面链接的一个漂亮的代码片段:

 < ImageButton 
android:layout_width =wrap_content
android:layout_height =wrap_content
android:src =@ drawable / ic_overflow_holo_dark
android:contentDescription =@ string / descr_overflow_button
android:onClick =showPopup/>

然后用来显示弹出窗口:

 public void showPopup(View v){
PopupMenu popup = new PopupMenu(this,v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.actions,popup.getMenu());
popup.show();

Roman Roman Nurik将这个非常棒的工具组合在一起,以获得您想要的任何Material Design图标:



http://romannurik.github.io/ AndroidAssetStudio /



以及图片可在:

http://romannurik.github.io/AndroidAssetStudio/icons-actionbar.html#source.type=clipart& ; source.clipart = more_vert&安培; source.space.trim = 0&安培; source.space.pad = 0&安培;名称= ic_action_more_vert&安培;主题=光&安培;颜色= RGBA(33%2C%20150%2C%20243%2C%200.6)


What's the little widget with three dots? How can I add it to my app?

解决方案

This is not a widget at all. It is an ImageButton (borderless in style) using the overflow Icon that includes a PopupMenu

For documentation tutorial visits http://developer.android.com/guide/topics/ui/menus.html#PopupMenu

This refers to a nice code snippet from the link above:

  <ImageButton
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/ic_overflow_holo_dark"
       android:contentDescription="@string/descr_overflow_button"
       android:onClick="showPopup" />

Then use to show popup:

 public void showPopup(View v) {
     PopupMenu popup = new PopupMenu(this, v);
     MenuInflater inflater = popup.getMenuInflater();
     inflater.inflate(R.menu.actions, popup.getMenu());
     popup.show();
 }

And Roman Nurik put together this awesome tool to get any Material Design icon you want:

http://romannurik.github.io/AndroidAssetStudio/

and the image is available at:

http://romannurik.github.io/AndroidAssetStudio/icons-actionbar.html#source.type=clipart&source.clipart=more_vert&source.space.trim=0&source.space.pad=0&name=ic_action_more_vert&theme=light&color=rgba(33%2C%20150%2C%20243%2C%200.6)

这篇关于android中cardview内有三个点的小部件的名称是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆