Centered drawing capability using XML

I want to host an image as a launcher screen. Since I don't want to use a layout for this (which would be useless to use the launch screen because of the launch time), I want to place windowBackground

using a xml

drawable.

Unfortunately, I can not find anything that can emulate the ImageView CENTER_CROP

inside drawable, and the tag bitmap " xml

do not seem to have this property.

Since I am unable to execute any code (due to the origin of the startup screen, which should be immediate), I am wondering if a new one can be defined xml

to be placed in a file xml

. So I could develop a new one XML Drawable

to achieve the result.

thank

+3


source to share


1 answer


I had a problem setting windowBackground via XML and came across your post. I know this is pretty old now, but in case someone else comes across your question, have you seen the "clip" options in the gravity setting?

android:gravity=["top" | "bottom" | "left" | "right" | "center_vertical" |
                      "fill_vertical" | "center_horizontal" | "fill_horizontal" |
                      "center" | "fill" | "clip_vertical" | "clip_horizontal"]

      



Here's the link: https://developer.android.com/guide/topics/resources/drawable-resource.html#Bitmap

0


source







All Articles