ActionBar.setBackgroundDrawable is stretched, not stretched

I want to set the background of my ActionBar and have it stretchable keeping its aspect ratio until both sizes are greater than or equal to the width / height of the action bar.

By default, it seems to stretch each dimension to fit, so the inference from the drawing is skewed. This is how I do it:

getActionBar().setBackgroundDrawable(
    getResources().getDrawable(R.drawable.my_image));

      

Is there a way to tell the action bar (like ImageView) to use the stretch mode I want?

thank

+3
android


source to share


No one has answered this question yet

Check out similar questions:

105
What's the difference between the types CENTER_INSIDE and FIT_CENTER?
37
ImageView fills parent width or height but maintains aspect ratio
eleven
ConstraintLayout aspect ratio
6
Scaling a bitmap in layer format
4
How to keep the aspect ratio of the image if the image is first stretched to fill the parent
3
Scaling bitmap maintaining aspect ratio and setting width and height
1
ImageView maintains height to height ratio
1
Android: how to stretch the background image to the width of the screen, cropping it vertically and maintaining the aspect ratio?
1
Image stretching height and aspect ratio maintenance
0
Maintain aspect ratio of resized bitmap



All Articles
Loading...
X
Show
Funny
Dev
Pics