简体   繁体   English

Android:如何使用文本创建启动画面

[英]Android: how to create splash screen with text

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我按照这篇文章创建了它: https : //android.jlelse.eu/launch-screen-in-android-the-right-way-aca7e8c31f52

Is it possible to add some text?可以添加一些文字吗?

You can create a new layout for your splash screen.您可以为启动画面创建新layout 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打开Paint写你的文字并将文件保存为png图像

Import png file in drawables and add it in <layer-list> as an item below or above your logo/icon在 drawables 中Import png 文件并将其添加到<layer-list>作为徽标/图标下方或上方的item

<item android:bottom="50dp"> set position as you want <item android:bottom="50dp">根据需要设置位置

<?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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM