Android imagebutton how to change icon size
android, icons, imagebutton
Solution
For these ImageButtons set the images using (instead of src):
android:background="@drawable/image_name"
Next thing is set:
android:layout_height="10dp" //or any size required
android:layout_width="10dp" //or any size required ... let these 2 sizes be same for both the ImageButtons
"dp" or "dip" is device independent pixels. The android system will take care of the resizing for different screen resolutions
Also, a better thing to do would be to set-up hover images for your button separately.
Problem
I have been working on interfaces lately and I have many problems with imagebutton sizes. I'm very bad at designing stuff and I'm having major problems with the Android Icons. Thus, I have some questions regarding those. First of all this is my current layout: As you can see, I have two icons that have different sizes and that's not good. I can't seem to force them to take the same size. My questions are: 1 - How do I force them to take the same size? 2 - What are the recommended size differences for hdpi, ldpi,mdpi and xhdpi? 3 - Why, if I set the imageButton background color to the same color as the layout background, the Icon is moved as if there was no button in the background? Example: Thanks in advance!!