layer-list

Android text in drawable layer-list [closed]

痴心易碎 提交于 2019-12-22 01:13:24
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . 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=

How to center vector drawable in layer-list without scaling

半世苍凉 提交于 2019-12-20 08:09:59
问题 I am attempting to use a VectorDrawable in a LayerList without scaling the vector. For example: <layer-list> <item android:drawable="@color/grid_item_activated"/> <item android:gravity="center" android:drawable="@drawable/ic_check_white_48dp"/> </layer-list> The drawable ic_check_white_48dp id defined as: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android

Create layer list with rounded corners programmatically

▼魔方 西西 提交于 2019-12-18 15:17:31
问题 I am currently trying to convert the following XML to be created programmatically so that I can set the top corners and bottom corners as needed throughout my project. It is a simple Layer list that has two rectangles; one on top of another. I would like to use this as a background for a few different views so it is important that the result scales. <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:bottom="20dp"> <shape android:shape="rectangle" > <size

Android xml layer-list not displayed correctly on some devices

淺唱寂寞╮ 提交于 2019-12-17 19:28:11
问题 I have an xml layer list drawable as a background for view, which is not displayed correctl on some devices. I have a Huawei Ascend Mate with 4.2.2 which displays it ok. On Asus phonepad tablet with 4.1.2 i see just the item shape stroke and dont see the other items. What am I doing wrong? <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="@color/yellow_color" /> <

How to add shadow using a drawable behind solid color shape in xml?

若如初见. 提交于 2019-12-14 03:16:21
问题 I have a .png image which is a circular shape and is just a shadow. What I have is an ImageButton which has an image for it's android:src property. For it's background I can have an xml file in drawable file. What I want now is to have the shadow image which is a png to go behind another solid shape -> android:shape="oval". <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/shadowimg" /> <item>

Background with directional arrow

走远了吗. 提交于 2019-12-12 13:36:28
问题 I have a quick question on how to achieve a desired view of a background on a view. What I want is a directional arrow pointing in a direction as the overlay on a background of say a textview. For example (Beautiful MS Paint skills) I have already tried using a layer-list which isn't going to work in this case due to screen size changes or fluctuating content heights. Is there any other possible way to do this other than using a 9patch. I've been dreading to even research 9 patches due to my

How to show only top and bottom border

半城伤御伤魂 提交于 2019-12-12 07:27:27
问题 This is my XML code which works fine, the only problem is it's showing border on all four sides while I want only to show border on the top and on the bottom only. How can I do that? <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#FFFFFF" /> <stroke android:width="3dip" android:color="#B1BCBE" /> <padding android:bottom="0dip" android:left="0dip" android:right="0dip" android:top="0dip" /> </shape> 回答1: Try the

Single layer visible in LayerList widget (ArcGIS JavaScript)

走远了吗. 提交于 2019-12-12 02:43:42
问题 Is it possible to have a single layer visible on the map in this ESRI tutorial LayerList widget ? Each time you click on a layer, the previous one should deactivate. So you always have only one layer on the map. Michelle 回答1: I managed to write a code for you . Check it and let me know : <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Layer List Dijit<

Unable to understand layer-list

廉价感情. 提交于 2019-12-11 11:14:02
问题 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:top="4dp" android:right="4dp" android:bottom="4dp" android:left="4dp"> <shape android:shape="oval"> <solid android:color="#ff0000" /> </shape> </item> <item> <shape android:shape="oval"> <stroke android:width="2dp" android:color="#ff0000"/> </shape> </item> </layer-list> taken from here: https://stackoverflow.com/a/36003935/6007737 How is it giving me a ring shape? How

Use drawable multiple times but with different colours

懵懂的女人 提交于 2019-12-11 01:57:24
问题 I have a selector for a toggle button checked and unchecked - is there a way that I can use a custom layer list with a shape and use different colours? I am adding them in at runtime but using XML as the design. <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/toggle_custom"/> <item android:state_checked="false" android:drawable="@drawable/toggle_custom_off"/> </selector> And my toggle_custom and toggle_custom