• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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)!
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic