Android:如何用文字创建启动画面 [英] Android: how to create splash screen with text

查看:85
本文介绍了Android:如何用文字创建启动画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在启动画面中添加一些文字?我的启动画面不是单独的活动,并且我不想将其设置为标准活动.

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.

我是通过以下文章创建的: https://android.jlelse.eu/launch-screen -in-android-the-right-way-aca7e8c31f52

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?

推荐答案

您可以为初始屏幕创建一个新的layout.但是,如果您仍然不想创建它,那么可以通过讨厌的黑客来实现.

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.

打开Paint编写文本并将文件另存为png图片

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

Import png文件,并在<layer-list>中将其作为item添加到徽标/图标下方或上方

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

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

这篇关于Android:如何用文字创建启动画面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆