drawable

drawable == drawable?

坚强是说给别人听的谎言 提交于 2019-11-29 21:59:09
问题 This is my problem...: In my activity I have an ImageView and a Button . I want the Button to perform an action ONLY when the ImageView displays a certain drawable. And yes, this means that the ImageView is animating between various drawables that is coded such that it does not interrupt with what I want done. ImageView imgview = (ImageView)findViewById(R.id.imgviewsid); Resources res = getResources(); Drawable acertaindrawable = res.getDrawable(R.drawable.thecertaindrawable); Drawable

Drawing multiple shapes with ShapeDrawable in xml with Android

纵然是瞬间 提交于 2019-11-29 21:15:11
I am currently drawing a number of circles on a canvas in a custom view in code. the circles are static and do not change. I would like to draw them using a ShapeDrawable in xml to help clean up my code. I will have a number of different drawables which the user can select and therefore I don't want to do this in code. having 3 or 4 xml drawables seems a lot neater to me. I have created one circle in xml using a ShapeDrawable but am unable to add more than one shape to the xml. How do I add multiple shapes to an xml document using ShapeDrawable. Here's how I did a filled red circle with a one

Navigation drawer (menudrawer) Android 5 (lollipop) style

孤者浪人 提交于 2019-11-29 20:01:56
I'm using menudrawer library in my project (this one: https://github.com/SimonVT/android-menudrawer ). I'm updating my app to be compatible with API21 (Android 5 Lollipop) and Material Design. When you use this library with API21 menudrawer icon looks bad. I want to achieve transition you can see in the new Play Store (new menudrawer icon transition to arrow). What's the best way to do that? Is it possible with this library? The only solution I'm thinking at the moment is custom drawable. But maybe I can use native drawable some way? OK. I spent few hours with new API and I think that the best

Default selector background in Clickable Views

自闭症网瘾萝莉.ら 提交于 2019-11-29 19:42:55
I have some clickable views and I want to set the default available background that is present on list click (in ICS is a blue color). I have tried putting as background this: android:background="@android:drawable/list_selector_background" but it is not the default blue I have by default (the one I used is orange). What is the drawable used by default on android as click selector? Thanks It's list_selector_holo_dark or the equivalent holo light version; and these are the defaults in Honeycomb and above. list_selector_background is the non-holo version, used in Gingerbread and below. EDIT : I

Android Drawables memory leak

左心房为你撑大大i 提交于 2019-11-29 19:21:28
问题 I work with several large drawables and I don't know how to manage memory leaks. I tracked the heap size of my application and it doesn't stop to grow (as the allocated memory). It is especially the "byte array (byte[])" type which grows up and never decrease. (in the DDMS Heap view on Eclipse) My application is composed of one activity which uses fragments. Those fragments are displaying several large images. I tried to set drawables callback to null, set drawables to null, clear my volatile

How to get Mat with a drawable input in Android using OpenCV

三世轮回 提交于 2019-11-29 18:44:43
问题 I have some image files in the drawable folder. And now, I want to convert them into opencv Mat object. I've found a function: Mat img = Highgui.imread(inFile); which is reading a file path to get the Mat. However, I can't get path of my images as I can only read them by using their id like R.drawable.img1. How could I achieve what I want? 回答1: This should do Mat img = Utils.loadResource(context, refrenceimgID, Highgui.CV_LOAD_IMAGE_COLOR); Imgproc.cvtColor(img, gryimg, Imgproc.COLOR_RGB2BGRA

saving gif file from drawable into phone sd? and remove it from sd after usage

喜夏-厌秋 提交于 2019-11-29 17:58:18
I have been searching on how to save file from Drawable into sd card OR phone's internal storage. All examples such as this one showed only for PNG type, I want to get GIF file from my drawable and save it into phone sd, and later remove it from sd after usage. Anybody please help with the code? I appreciate it! As far as i know there isn't such a native function on Android (maybe related to patent issues). You may try this library for your purpose. Usually its meant to create animated GIF but a file with just one picture (frame) should also work. So a complete example could be like this

Android different drawable screen resolutions

我们两清 提交于 2019-11-29 17:38:47
问题 I'm a bit confused as to what resolutions I should be saving my images in for the different drawable folders. Is there a general formula for it? For example,if I want an image to take up 10% of the height and the full width of the screen, roughly how would I calculate what different resolutions I should save the image in? 回答1: This is android's guidelines for icons. Obviously not all drawables are icons, but maybe this helps you get started. 36x36 for low-density 48x48 for medium-density

How to reference a drawable from a library project into a main project's layout in android?

丶灬走出姿态 提交于 2019-11-29 16:55:18
问题 I have a android library project and reusable drawable resources in it. Lets say package name is: com.vijay.mylib; Then i have a main project and it uses the above library project. Lets say its package name is: com.vijay.myproject . Consider that I have linked library project with my main project correctly. In my main project i have a layout called main.xml. I want to use some drawable rom library project in main.xml. How can i do it in xml? Refering in normal way like "@drawable/myImage"

Opacity on a background Drawable image in View (using XML Layout)

纵然是瞬间 提交于 2019-11-29 16:21:19
问题 I was just wondering if there was a way to change the opacity of the background image for a View (ie. TextView , etc.). I know that I can set the background image like this: android:background="@drawable/my_drawable_image" Or I can set a specific background colour with an alpha setting like this: android:background="#10f7f7f7" Is there a way I can control the opacity (set the alpha) if I'm setting the background as a drawable image? And I want to do this in the XML Layout. I already know that