我想使用包含 2 个图像的启动屏幕:
- 主图像必须完全居中
- 次要图像必须位于底部和主图像之间的中心
The expected render is something like this:
But I don't see how to get this, and my second image is bottom aligned:
我的启动画面的 XML 是:
<?xml version="1.0" encoding="utf-8" ?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/ComplementColor" />
<padding
android:left="0dip"
android:top="0dip"
android:right="0dip"
android:bottom="0dip" />
</shape>
</item>
<item>
<bitmap android:src="@drawable/main_logo"
android:gravity="center" />
</item>
<item>
<bitmap android:src="@drawable/secondary_logo"
android:gravity="bottom" />
</item>
</layer-list>
我最终选择了另一个接近@Leonardo Cavazzani 建议的解决方案。
我在底部图像中添加了边距,如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/ComplementColor" />
<padding
android:left="0dip"
android:top="0dip"
android:right="0dip"
android:bottom="0dip" />
</shape>
</item>
<item>
<bitmap android:src="@drawable/main_logo"
android:gravity="center" />
</item>
<item
android:bottom="40dp">
<bitmap android:src="@drawable/secondary_logo"
android:gravity="bottom" />
</item>
</layer-list>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)