Android: how to create splash screen with text

*爱你&永不变心* 提交于 2020-04-13 06:08:59

问题


How can I add some text to splash screen? My splash screen isn't a separate activity and I don't want to make it as standard activity.

I created it by following this article: https://android.jlelse.eu/launch-screen-in-android-the-right-way-aca7e8c31f52

Is it possible to add some text?


回答1:


You can create a new layout for your splash screen. But if you still don't want to create it then there is a nasty hack to achieve it.

Open Paint write your text and save the file as png image

Import png file in drawables and add it in <layer-list> as an item below or above your logo/icon

<item android:bottom="50dp"> set position as you want

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:opacity="opaque">
    <item android:drawable="@color/colorPrimary"/>
    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/icon"/>
    </item>
    <item android:bottom="50dp">
        <bitmap
            android:gravity="center"
            android:src="@drawable/myTextImage"/>
    </item>
</layer-list>


来源:https://stackoverflow.com/questions/51110573/android-how-to-create-splash-screen-with-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!