Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

enter image description here

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

like image 676
Cristofor Avatar asked Aug 01 '15 19:08

Cristofor


People also ask

How do I add three dots to my Android toolbar?

Right-click res folder and create a new Resource Directory of type menu. Right-click the menu directory and create a new resource file. From there you can drag and drop a menu item from the XML design. That should give you the 3 dots.

What are the dots on Google called?

The grid of the nine small boxes that are found on the top right corner of the browser when using various Google products like Google Chrome and Gmail is popularly known as the “Waffle”.


2 Answers

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

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

enter image description here

like image 187
kandroidj Avatar answered Nov 02 '22 09:11

kandroidj


You may also simply use an ImageButton with the actionOverflowButtonStyle style attribute.

<ImageButton     android:layout_width="wrap_content"      android:layout_height="wrap_content"      style="?android:attr/actionOverflowButtonStyle"/> 
like image 43
Nit Avatar answered Nov 02 '22 09:11

Nit