-1

I want to know How To make icons just before the text in overflow menu in this photo and also how to make this share button. This Share Button Just share the text across whatsapp,google etc.

Image

Ishaan Kumar
  • 968
  • 1
  • 11
  • 24

1 Answers1

1

To make an icon in a specific side of a Button you could use one of the attributes offered by the android SDK : android:drawableBottom, android:drawableTop, android:drawableLeft, android:drawableRight, android:drawableStart or android:drawableEnd

EDIT: to make icon in overflow menu button you have to use the android:icon attribute to specify the icon's drawable reference and then add this attribute to force the button title to be shown app:showAsAction="never|withText"

Fouad Wahabi
  • 804
  • 7
  • 16
  • Nothing Works. – Ishaan Kumar May 21 '15 at 10:30
  • no , this works with `Button`s as I mentioned above, so you're talking about making icon in `ActionBar` menu ?? please try to be clear in you're question !! , in this case you have to use the `android:icon` attribute and `app:showAsAction="ifRoom|withText"` – Fouad Wahabi May 21 '15 at 11:22
  • Yes I want it in the overflow menu and I want to add icon in them, see the image i have attached – Ishaan Kumar May 21 '15 at 16:37
  • I have followed your suggestion but the output I'm getting is this(image attached). But I want them in the overflow menu just like the image which I had attached in my question. – Ishaan Kumar May 21 '15 at 17:32
  • I have followed your suggestion but the output I'm getting is this(image attached). But I want them in the overflow menu just like the image which I had attached in my question. OUTPUT - https://drive.google.com/file/d/0B0gYnUjTCiZHRVpHelJoaGFXTlk/view?usp=sharing XML - https://drive.google.com/file/d/0B0gYnUjTCiZHMURZZ3NUeDNZY0E/view?usp=sharing – Ishaan Kumar May 21 '15 at 17:39
  • you just have to replace `ifRoom` by `never` to force showing buttons only in the overflow menu – Fouad Wahabi May 21 '15 at 17:47
  • Ok now i have done what u had suggest but still not getting the image. OUTPUT - https://drive.google.com/file/d/0B0gYnUjTCiZHVmVhVUgyRTR3b00/view?usp=sharing XML - https://drive.google.com/file/d/0B0gYnUjTCiZHdHlWeU5CWTA3Wm8/view?usp=sharing – Ishaan Kumar May 21 '15 at 18:29
  • Do I need to add something more to get the image. Do image size matters? I have the image of size 48X48 – Ishaan Kumar May 21 '15 at 18:54
  • take a look at this answer it may helps : http://stackoverflow.com/questions/18374183/how-to-show-icons-in-overflow-menu-in-actionbar/22288914#22288914 , I think cause you're working with android 5+ version this may not works but just make a try – Fouad Wahabi May 21 '15 at 19:07
  • I didn't even understand the question I know its not possible using the native API. Is there a work around to implement that kind of view. Well thanks for your help. I think i should drop the idea of having icons in my menu. – Ishaan Kumar May 21 '15 at 19:14