drawable

Android resources “best match” fallback logic

走远了吗. 提交于 2019-12-01 09:41:45
问题 I've read the docs about Android Resources and I think I've understood the best-matching logic used by android to identify in which directory a particular resource should be searched first.. Supposing that drawable-hdpi , drawable-en-port and drawable-en* match the current device configuration, drawable-en-port is the best matching directory.. My question is, if a drawable is not found in drawable-en-port , does the system look directly in drawable or does it look in the second-best-match

Android Change Widget Background Image

血红的双手。 提交于 2019-12-01 08:36:55
Been struggling for the past two days to change the background of my widget, based on some if statements (removed right now just want to change the widget background from the class) here is my source below. What's up though, I've changed images before fine such as backgrounds but can not get it to work for my widget thank you. This is my most recent attempt by the way //Widget Provider Class public class WidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int N = appWidgetIds.length; for (int i=0; i<N;

How to create transparent semicircle? [closed]

邮差的信 提交于 2019-12-01 06:27:48
I want to create this effect.TextView with transparent semicircle as backgound . I tried add drawable as background. <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <solid android:color="#00000000" /> </shape> also i tried this stackoverflow similar question ,but it doesn't work for me. Can anyone help me? You cannot create a semicircle from xml. but you could achieve what you are looking for using a circle with appropriate margin & padding. Create a fixed sized circle like this: <?xml version="1.0" encoding="utf-8

Add drawable to EditText's top|left corner

时间秒杀一切 提交于 2019-12-01 05:41:26
I know that in Android we can use function setCompoundDrawables(..) to add drawable. My problem is that my EditText is multy-lines and i want to put drawable in EditText's top|left corner. But using at setCompoundDrawables() function, only give choice to put drawable in specific side. Is it possibility at Android API to Do it? sandrstar Seems it's impossible to do it with only EditText / TextView without anyside effect and additional views (I've provided the way at the end, but it needs more work with image and can be not applicable for every phone, because of different edit text backgorunds

How to create transparent semicircle? [closed]

坚强是说给别人听的谎言 提交于 2019-12-01 05:18:38
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I want to create this effect.TextView with transparent semicircle as backgound . I tried add drawable as background. <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <solid android:color="#00000000" /> </shape> also i tried this

How to make bottom border in drawable shape XML selector?

倖福魔咒の 提交于 2019-12-01 03:16:32
I'm trying to create a drawable shape with different states for my button. So I wrote this: <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" android:color="@android:color/black" > <shape android:shape="rectangle" > <solid android:color="@color/NEGATIVE_pressed" /> <stroke android:width="1dp" android:color="@color/ORANGE" /> <corners android:radius="4dp" /> </shape> </item> <item android:state_focused="true" android:color="@android:color/black" > <shape android:shape="rectangle" > <solid android:color="@color/NEGATIVE_focused" /> <stroke

Android Gradient drawable programmatically

回眸只為那壹抹淺笑 提交于 2019-12-01 03:02:16
I have a gradient drawable defined in xml that I use it as a background, like this: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:bottom="4dp"> <shape> <gradient android:startColor="@color/blue" android:endColor="@color/dark_blue" android:angle="270" /> </shape> </item> <item android:top="98dp"> <shape> <gradient android:startColor="@color/black" android:endColor="@color/transparent_black" android:angle="270" /> </shape> </item> </layer-list> I need to implement this programmatically. I have tried to use a

is there any way to find resource Id of drawable

梦想的初衷 提交于 2019-12-01 02:42:33
Is there any way to get the Drawable resource ID? For example, I am using an ImageView and I may initially use icon.png as its image but later I may change the image to icon2.png. I want to find out using the code that which image my ImageView is using from the resource. Is there any way? Are you trying to determine what the current image is on the imageview , in order to change it to some other image? If that's so I suggest doing everything using code instead of xml. i.e. Use setImageResource() to set the initial images during initialization and keep track of the resource ids being used

Add drawable to EditText's top|left corner

拥有回忆 提交于 2019-12-01 02:33:54
问题 I know that in Android we can use function setCompoundDrawables(..) to add drawable. My problem is that my EditText is multy-lines and i want to put drawable in EditText's top|left corner. But using at setCompoundDrawables() function, only give choice to put drawable in specific side. Is it possibility at Android API to Do it? 回答1: Seems it's impossible to do it with only EditText / TextView without anyside effect and additional views (I've provided the way at the end, but it needs more work

Gallery/AdapterView Child Drawable State

时间秒杀一切 提交于 2019-12-01 01:56:19
问题 I am using a Gallery view where the view corresponding to each item is non-trivial and consists of text as well as multiple buttons. When I click to drag the gallery view (somewhere not on one of the buttons) the button's drawable state changes to pressed and appears as if all of the buttons are currently being pressed. Additionally, the same behavior happens for the selected state (e.g. all of the text of the child TextViews changes color). I am trying to prevent this behavior and have found