Android text in drawable layer-list [closed]

痴心易碎 提交于 2019-12-22 01:13:24

问题


This is for my splash screen. I am assembling my background using a layer-list. How do I add text to the layer list?


回答1:


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>


来源:https://stackoverflow.com/questions/38161959/android-text-in-drawable-layer-list

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