Android: How To Align 2 Images On A Splash Screen
I would like to use a splah screen containing 2 images: the main image must be fully center the secondary image must be center between the bottom and the main image The expected
Solution 1:
I've finally choose another solution close to that suggested by @Leonardo Cavazzani.
I've added a margin to the bottom image like this:
<?xml version="1.0" encoding="utf-8" ?><layer-listxmlns:android="http://schemas.android.com/apk/res/android"><item><shapeandroid:shape="rectangle"><solidandroid:color="@color/ComplementColor" /><paddingandroid:left="0dip"android:top="0dip"android:right="0dip"android:bottom="0dip" /></shape></item><item><bitmapandroid:src="@drawable/main_logo"android:gravity="center" /></item><itemandroid:bottom="40dp"><bitmapandroid:src="@drawable/secondary_logo"android:gravity="bottom" /></item></layer-list>
Solution 2:
Set a marginBottom for your bitmap
<bitmapandroid:src="@drawable/secondary_logo"android:gravity="bottom"android:layout_marginBottom="100dp" />
Solution 3:
You can achieve it trough the LayoutXML instead of the Drawable.XML
A simple LayoutManager where the first image is centered and the second alignedToTheBottom of the first plus topMargin solve your problem.
Post a Comment for "Android: How To Align 2 Images On A Splash Screen"