drawable

How to rotate a drawable by ObjectAnimator?

强颜欢笑 提交于 2019-12-03 22:43:40
Alphaing a drawable work well like this: if(mAlphaAnimation == null){ mAlphaAnimation = ObjectAnimator.ofFloat(this, "alpha", 0.0f,1.0f).setDuration(TARGET_ANIM_ALPHA_DURATION); mAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); mAlphaAnimation.setStartDelay(TARGET_ANIM_ALPHA_DELAY_BASE*power); mAlphaAnimation.setRepeatCount(ValueAnimator.INFINITE); mAlphaAnimation.setRepeatMode(ValueAnimator.REVERSE); mAlphaAnimation.addUpdateListener(this); } But if I want rotate a drawable like below , it don's work. private void createRotateAnim(float fromDegress,float toDegress,int

ItemizedOverlay Rotate marker and crash

不打扰是莪最后的温柔 提交于 2019-12-03 21:52:58
Bit of a strange post as this is something I posted before, thought it was solved but didn't! I have a situation where I need to use a custom Drawable for each marker, the effect I need is to rotate the marker by a set number of degrees and am probably going the wrong way about this completely. As a start I am using the excellent Creative Commons as this does work and only breaks after my additions! https://github.com/commonsguy/cw-advandroid/tree/master/Maps/NooYawkAsync The previous post and the code is here Android Maps NullPointerException ItemizedOverlay If anyone can recommend a better

How to load resource from another package in xml?

偶尔善良 提交于 2019-12-03 21:22:30
I know that exists ability to install resource xml file from another package in code like this: String resourceName = getResources().getResourceEntryName(layoutResID); String resourceTypeName = getResources().getResourceTypeName(layoutResID); Resources skinResources = getResourcesForPackage("com.my.skin"); int skinResourceId = skinResources.getIdentifier(resourceName, resourceTypeName, "com.my.skin"); mLayoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); mLayoutInflater.inflate(skinResources.getXml(skinResourceId), null); super.setContentView(mLayoutInflater

Change drawable start color and end color dynamically in android activity class

孤人 提交于 2019-12-03 21:04:51
Hi I am developing one android application in which I drawable resource to set backgroung for button. I want to change start and end color for that drawable programatically i.e. in activity class inside button click listener. My drawable looks like : <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#be584c" android:endColor="#be584c" android:angle="270" /> <corners android:radius="2dp" /> <stroke android:width="1px"/> </shape> And I set it as background for button in xml file.

mdpi image is too small for 10" android tablet

落爺英雄遲暮 提交于 2019-12-03 18:35:37
问题 I have drawables for each density as ldpi,mdpi,hdpi and xhdpi. Problem: Both 10" tablet device (1280x800) and a handset device 320x480 uses medium density. I have an 35x35 mdpi image. But this image is too small for tablet whereas it is ok for handset. I read relevant documents. But I guess I couldn't understand sth significant. Is there anyway for tablet use xhdpi images or I wonder how to use bigger images for mdpi tablet. 回答1: You should add a second identifier large and/or xlarge to your

With default resources in the drawable folder (MDPI sized) what's the point of the drawable-mdpi folder?

烂漫一生 提交于 2019-12-03 17:41:58
问题 I've a full set of images at the various different pixel densities, and I need to put bitmap resources into the drawables folder (at MDPI) to use as default resources (to prevent crashing on pixel density devices I've not catered to, e.g. xhdpi), but that means duplicating the resources in the drawable-mdpi into the drawable folder. So as duplication is clearly bad, I'm wondering whether I should just delete the drawable-mdpi folder, and keep my MDPI resources in the (default) drawable folder

PackageManager.getApplicationIcon() returning default icon?

℡╲_俬逩灬. 提交于 2019-12-03 16:43:59
Is there a way to tell if the Drawable I'm getting back from getApplicationIcon() is a default/built-in icon or not? For example, I have several applications installed on my emulator. "Adobe Reader" has an icon provided by Adobe. "com.android.gesture.builder" and "Sample Soft Keyboard", on the other hand, have a generic Android icon. getApplicationIcon() for those two packages returned different BitmapDrawable objects, but running getBitmap() on those two objects returned the same Bitmap object (android.graphics.Bitmap@401a7df8). The only idea I have so far is to do something like How to

Set a drawable as background programmatically

情到浓时终转凉″ 提交于 2019-12-03 16:14:29
问题 EDIT: Sorry i realize from your comment my question was not clear enough. I will post a new one. Sorry for this and thanks for your answers I am populating a listview from a Json file. With my listadapter, I can easily assign appropriate json data to each row of my list. That works well for text, for example: TextView tv = (TextView)ll.findViewById(R.id.descView); tv.setText(i.desc); With the above code, every row will be correctly populated by the good json data. However, I don't manage to

Android: drawable id change after resources modify

爱⌒轻易说出口 提交于 2019-12-03 16:07:11
问题 I have an android application that use a gallery component to choose an icon and assign it to a button. The icon set is located in res/drawable folder and is accessed in the gallery with the typical adapter of the guide: private Integer[] Imgid = { R.drawable.icon_home, R.drawable.icon_home2, ... } After an icon choosing, i stored the settings in a db with id of the button and of the drawable. All works done, but i've noticed that if i'll want to add or modify my icon set or resources in

How to set drawable size in layer-list

夙愿已清 提交于 2019-12-03 14:35:37
问题 I'm having problem with setting size of drawable in layer-list. My XML looks like this: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/menu_drawable1"/> <item android:drawable="@drawable/menu_drawable2"/> </layer-list> Drawable1 is bigger than Drawable2, so Drawable2 gets resized. How to override this and set the original size of Drawable2? I don't want it to resize. I tried with setting width and height but that doesn't work. Also