android-drawable

Standard Android menu icons, for example refresh [closed]

穿精又带淫゛_ 提交于 2019-11-26 18:04:53
The Android SDK offers the standard menu icons via android.R.drawable.X . However, some standard icons, such as ic_menu_refresh (the refresh icon), are missing from android.R . Is there any way to get the original icons, maybe by extracting them from the applications? I already checked the Android source, but it's a bit too huge to look everywhere for the images. I know the Android Drawables website, but I would like to get the correct hdpi , mdpi and ldpi version, preferable the original ones. Never mind, I found it in the source: base.git/core/res/res and subdirectories. As others said in

What is the difference between Bitmap and Drawable in Android?

假装没事ソ 提交于 2019-11-26 17:59:28
问题 I googled but i couldn't find any article to describe about the difference between Bitmap and Drawable in Android. 回答1: A Bitmap is a representation of a bitmap image (something like java.awt.Image). A Drawable is an abstraction of "something that can be drawn". It could be a Bitmap (wrapped up as a BitmapDrawable ), but it could also be a solid color, a collection of other Drawable objects, or any number of other structures. Most of the Android UI framework likes to work with Drawable

Getting Bitmap from vector drawable

一世执手 提交于 2019-11-26 17:19:00
In my application, I have to set a large icon for a notification. LargeIcon must be a Bitmap, and my drawables are vector images (the new feature in Android, see this link ) The problem is when I try to decode a resource that is a vector image, I get a null returned. Here is the sample of code : if (BitmapFactory.decodeResource(arg0.getResources(), R.drawable.vector_menu_objectifs) == null) Log.d("ISNULL", "NULL"); else Log.d("ISNULL", "NOT NULL"); In this sample, when I replace R.drawable.vector_menu_objectifs with a "normal" image, a png for exemple, the result is not null (I get the correct

How to define a circle shape in an Android xml drawable file?

非 Y 不嫁゛ 提交于 2019-11-26 16:46:18
I have some problems finding the documentation of the definitions of shapes in XML for Android. I would like to define a simple circle filled with a solid color in an XML File to include it into my layout files. Sadly the Documentation on android.com does not cover the XML attributes of the Shape classes. I think I should use an ArcShape to draw a circle but there is no explanation on how to set the size, the color, or the angle needed to make a circle out of an Arc. This is a simple circle as a drawable in Android. <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas

How to change a layer-list drawable?

六月ゝ 毕业季﹏ 提交于 2019-11-26 15:59:58
Trying to learn some new things and can't figure this one out, any help is appreciated. Given this simple code which is right from Google's documentation: layers.xml: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/first_image"> <bitmap android:src="@drawable/android_red" android:gravity="center" /> </item> <item android:id="@+id/second_image" android:top="10dp" android:left="10dp"> <bitmap android:src="@drawable/android_green" android:gravity="center" /> </item> <item android:id="@+id/third_image" android

How to add an image to the “drawable” folder in Android Studio?

爷,独闯天下 提交于 2019-11-26 15:37:14
I need to add an image to the res/drawable folder... When I choose new > image asset , it comes out a dialog to choose Asset Type ... How can I add an image to res/drawable folder? Chris Rock For Android Studio 1.5 : Right click on res, new Image Asset On Asset type choose Action Bar and Tab Icons Choose the image path Give your image a name in Resource name Next->Finish Update for Android Studio 2.2 : Right click on res, new Image Asset On Icon Type choose Action Bar and Tab Icons On Asset type choose Image On Path choose your image path Next->Finish The image will be saved in the /res

Changing color in a shape inside a layer-list programmatically

。_饼干妹妹 提交于 2019-11-26 14:44:52
问题 I am trying to change programmatically the color of the selectable_kachel_shape . Here is the xml file: kachel_ticked_style.xml <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:id="@+id/selectable_kachel_shape" android:shape="rectangle" > <stroke android:width="5dp" android:color="@color/headrbar_color" /> </shape> </item> <item> <rotate android:fromDegrees="45" android:pivotX="120%" android:pivotY="100%" android:toDegrees="45" > <shape android

Setting drawable folder to use for different resolutions

强颜欢笑 提交于 2019-11-26 14:13:33
I have 4 different sizes for each of the icons I need to use in my app. The problem is My Nexus 7 (1280 x 800) and galaxy s2 (800 x 480) seem to use the resources in drawable-hdpi. How do I force the Nexus to use resources in drawable-xhdpi and then the 10 inch tab to use drawable-xxhdpi. I have this in my manifest file <supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" /> How do I force the Nexus to use resources in drawable-xhdpi and then the 10 inch tab to use

Android setBackgroundResource cause out of memory excepiton

流过昼夜 提交于 2019-11-26 13:04:16
问题 I\'m working on a gamebook application that shows 12 views in a ViewPager. This is my custom PagerAdapter : private class ImagePagerAdapter extends PagerAdapter { private int[] mImages = new int[] { R.drawable.copertinai, R.drawable.blui, R.drawable.azzurroi, R.drawable.rossoi, R.drawable.gialloi, R.drawable.verdei, R.drawable.rosai, R.drawable.grigioi, R.drawable.neroi, R.drawable.arancionei, R.drawable.marronei, R.drawable.violai, R.drawable.ulm }; @Override public int getCount() { return

Using android vector Drawables on pre Lollipop crash

*爱你&永不变心* 提交于 2019-11-26 12:55:48
I'm using vector drawables in android prior to Lollipop and these are of some of my libraries and tool versions: Android Studio : 2.0 Android Gradle Plugin : 2.0.0 Build Tools : 23.0.2 Android Support Library : 23.3.0 I added this property in my app level Build.Gradle android { defaultConfig { vectorDrawables.useSupportLibrary = true } } It is also worth mentioning that I use an extra drawable such as LayerDrawable(layer_list) as stated in Android official Blog ( link here ) for setting drawables for vector drawables outside of app:srcCompat <level-list xmlns:android="http://schemas.android