可绘制图层列表中的Android文本 [英] Android text in drawable layer-list

查看:103
本文介绍了可绘制图层列表中的Android文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用清单文件的<activity/>标记中的主题调用来实现初始屏幕,而无需进行任何额外的活动.

I am trying to implement splash screen without any extra activities, using theme call in the manifest file's <activity/> tag.

以我的styles.xml

In my styles.xml

<style name="splashTheme" parent="AppTheme">
        <item name="android:windowBackground">@drawable/splash</item>
</style>

此处可绘制文件splash.xml使用layer-list 如何在此图层列表中添加文本?​​

here the drawable file splash.xml uses layer-list How do I add text to this layer list?

推荐答案

可绘制图层列表中添加 文本 的一种方法 em> 是通过创建文本的 png文件 并使用 位图 添加它.这是一个例子.

One way to add Texts in your drawable layer-list is by creating a png file of the text and adding it using bitmap. Here is one example of it.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:drawable="@drawable/background"/>

    <item android:bottom="150dp">
        <bitmap
            android:gravity="center"
            android:src="@drawable/logo"/>


    </item>
    <item android:top="60dp">
        <bitmap
            android:gravity="center"
            android:tint="@android:color/white"
            android:src="@drawable/text"/>
    </item>
</layer-list>

这篇关于可绘制图层列表中的Android文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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