Android text in drawable 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. 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=”https://stackoverflow.com/questions/38161959/@drawable/logo”/> </item> <item android:top=”60dp”> <bitmap android:gravity=”center” android:tint=”@android:color/white” android:src=”@drawable/text”/> </item> </layer-list>

how to get android gradient center light effect?

Make a new Android xml file (say GreyRadial.xml) file in your drawable folder In your xml file <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle” > <gradient android:centerColor=”#c1c1c1″ android:endColor=”#4f4f4f” android:gradientRadius=”400″ android:startColor=”#c1c1c1″ android:type=”radial” > </gradient> </shape> Use this xml in your layout background using android:background=”@drawable/GreyRadial”

Using layer-list to display some drawable images

Update your layer-list as follows <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item> <shape> <gradient android:centerX=”0.5″ android:centerY=”0.1″ android:endColor=”#08e25b” android:gradientRadius=”300dp” android:startColor=”#b7e9c9″ android:type=”radial” /> </shape> </item> <item android:width=”48dp” android:height=”48dp” android:bottom=”68dp” android:right=”-20dp”> <bitmap android:gravity=”bottom|right” android:src=”@drawable/peas” /> </item> <item android:width=”68dp” android:height=”68dp” android:bottom=”-20dp” android:left=”-20dp”> <bitmap android:gravity=”bottom|left” android:src=”@drawable/peas” /> </item> </layer-list>

Shaped drawable with selectableItemBackground as background

Having round_corners.xml: <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <solid android:color=”@android:color/transparent”/> <corners android:radius=”15dp” /> <stroke android:width=”1px” android:color=”#000000″ /> </shape> And my_ripple.xml: <?xml version=”1.0″ encoding=”utf-8″?> <ripple xmlns:android=”http://schemas.android.com/apk/res/android” android:color=”?android:attr/colorControlHighlight”> <item android:id=”@android:id/mask”> <shape android:shape=”rectangle”> <solid android:color=”#000000″ /> <corners android:radius=”15dp” /> </shape> </item> <item android:drawable=”@drawable/round_corners” /> </ripple> And button: <Button android:background=”@drawable/my_ripple” … /> Will result in this: See this article.

Android shape border with gradient

try something like this: <?xml version=”1.0″ encoding=”UTF-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android” > <item> <shape android:shape=”rectangle” > <gradient android:angle=”360″ android:centerColor=”#e95a22″ android:endColor=”#ff00b5″ android:gradientRadius=”360″ android:startColor=”#006386″ android:type=”sweep” /> <stroke android:width=”2dp” android:color=”#ff207d94″ /> </shape> </item> <item android:bottom=”2dp” android:left=”2dp” android:right=”2dp” android:top=”2dp”> <shape android:shape=”rectangle” > <solid android:color=”#fff” /> </shape> </item> </layer-list>

Android Background Drawable Not Working in Button Since Android Studio 4.1

The Android Studio 4.1 new-project wizard, for many of its templates, has the project use the Material Components for Android library. And, it sets up the default theme to be based on Theme.MaterialComponents.DayNight.DarkActionBar. A side effect of this is that any <Button> elements in a layout get turned into MaterialButton widgets, not regular Button widgets. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)