• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ImageButton drawable background not centered and cropped

 
Greenhorn
Posts: 4
Android Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this ImageButton



where crimson_round_button.xml drawable is



and the play_white.png drawable represents only the white play icon in the button.

My final result is this one




A you can see the inner icon looks not aligned with the center of the circle and you can notice that the right and bottom borders are a little bit cropped.

The reason is that the applied background is not fitting the ImageButton, as you can see in this image where I selected the ImageButton in Android Studio preview



I also made a try removing the image from the button, but as you can see the result is always the same, the circle set as ImageButton background is no more a circle, it's cropped on the left side and at the bottom



and setting a 4dp elevation to the ImageButton the cropped border is much more visible



Any idea why this is happening?

TIA
 
Elia Bigogno
Greenhorn
Posts: 4
Android Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OMG! It's just a problem of the preview in Android Studio and in the emulator (if not really zoomed)!
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic