Tell me, please, how to add an icon to the button. I do this:

<Button android:id="@+id/contextMenuButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:icon=" @android :drawable/ic_menu_view" /> 

But I get a regular button without an icon, whereas I would like a button that looks like a context menu (the one called overflow). It seems to have heard that the icon for overflow is stored in android sdk and can be obtained from this id:

 @android :drawable/ic_menu_view 

But nothing comes out. Tell me how to make the button look like a context menu button? Thank you in advance!

1 answer 1

If you need not a button with an icon, but just an icon, then use ImageView instead of Button :

 <ImageView android:id="@+id/contextMenuButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src=" @android :drawable/ic_menu_view" /> 
  • Thanks, it seems that it should. Can you tell me the name of the context menu icon id (the one overflow) in the form of three square dots? And then in the icon ic_menu_view in general, some eye is depicted - JuniorTwo
  • @JuniorTwo, id don't know ... I downloaded from the Internet myself. It is necessary to google "overflow". More on Habré laid out the link to the archive with the new icons. - Yuriy SPb