美文网首页
设置Splash页面的内容

设置Splash页面的内容

作者: 苍蝇的梦 | 来源:发表于2018-10-16 10:48 被阅读51次

2018-10-16 遇到的一点小问题
最近app的闪屏图,刚开始是使用的:

 <style name="wannoo.xxx.Splash">
        <item name="android:windowBackground">@drawable/xxx</item>
    </style>

但是因为屏幕尺寸不一致,可能会出现变形。

考虑到闪屏图是纯色背景,中间显示logo。所以使用setContentView(R.layout.xx);来处理,因为之前经常使用的那个android.support.percent.PercentFrameLayout已经是@Deprecated标识了,所以layout里面使用的推荐的android.support.constraint.ConstraintLayout,然后使用app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"让ImageView居中,宽度先暂定的父布局的0.3,使用app:layout_constraintWidth_percent="0.33" 。预览效果还可以,但真正跑起来时遇到了问题,会先显示android:windowBackground一段时间才开始显示layout的内容。

只好又换回设置android:windowBackground,然后再考虑变形问题。网上找了下,看到解决方案了。稍微改了下,试了一下,图标尺寸自定义,大概是可以了。

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <color android:color="@color/xxx" />
    </item>
    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/xxxxx" />
    </item>
</layer-list>
splash

有看到一个直接使用fir更新的库
记录一下,2018年9月20日。
有个群里推荐的天气APIWeather API. Sattelite imagery API. - OpenWeatherMap
记录一下,2018年8月30日。

相关文章

网友评论

      本文标题:设置Splash页面的内容

      本文链接:https://www.haomeiwen.com/subject/ffggnftx.html