Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android text in drawable layer-list [closed]

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

In my styles.xml

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

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

like image 710
Katedral Pillon Avatar asked Jul 02 '16 16:07

Katedral Pillon


People also ask

How do I add text to a layer list?

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

How do I create an XML file in a drawable folder?

Right Click on Drawable folder -> New -> Drawable Resource File , will create a XML file inside the Drawable folder.

What is stroke in android XML?

Sometimes you want an outline around your shape and to do that you can use the stroke tag. You can specify the width and color of the outline using android:width and android:color.

What is Layer list in android?

Layer list. A LayerDrawable is a drawable object that manages an array of other drawables. Each drawable in the list is drawn in the order of the list—the last drawable in the list is drawn on top. Each drawable is represented by an <item> element inside a single <layer-list> element.


1 Answers

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> 
like image 127
opticod Avatar answered Oct 02 '22 05:10

opticod