What's the name of the little widget with three dots inside a cardview in android?

后端 未结 5 1234
滥情空心
滥情空心 2021-01-30 16:55

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

5条回答
  •  死守一世寂寞
    2021-01-30 16:55

    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:

      
    

    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();
     }
    

    3-Dots button is available among Assets in Android Studio:

    Right click on res -> New -> Vector Assets -> Asset Type = Clip Art

    -> Click on the button next to Clip Art: label -> Search for more vert

提交回复
热议问题