android-drawable

How to create this shape drawable

最后都变了- 提交于 2019-12-23 02:33:04
问题 I want to create xml drawable to this shape, 回答1: use this layout and save in drawable folder..... <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <size android:width="200dp" android:height="50dp" /> <solid android:color="#ef45d1" /> <corners android:topRightRadius="20dp" /> </shape> </item> <item android:bottom="0dp" android:right="165dp" android:top="0dp"> <rotate android:fromDegrees="45"

Creating android RadioGroup with multiple RadioButton (Custom RadioGroup)

爷,独闯天下 提交于 2019-12-23 01:46:24
问题 I want to achieve Single RadioGroup like below image for blood group selection. How can this be done? 回答1: I created my own RadioGridLayout which include RadioGroup code and extends GridLayout. You can copy this code. For me working well. After you can use this layout in your xml and customize like grid layout. For R.styleable.RadioGridLayout_checked I used code like this: <resources> <declare-styleable name="RadioGridLayout"> <attr name="checked" format="integer" /> </declare-styleable> <

Loop animation drawable

我的未来我决定 提交于 2019-12-23 01:12:07
问题 I'm trying to animate some png and i would loop the animation. This is my code: wave.setBackgroundResource(R.drawable.wave_animation); frameAnimation = (AnimationDrawable)wave.getBackground(); frameAnimation.setCallback(wave); frameAnimation.setVisible(true, true); frameAnimation.start(); and here the xml with the png <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:drawable="@drawable/wave_01" android:duration="200" /> <item

Use custom selector for parent item and children items in ExpandableListView

懵懂的女人 提交于 2019-12-22 18:44:07
问题 I have expandable list which looks like this: Orange items are children and are shown when you press specific parent. Blue items are parents.I used this custom adapter to create this: (I picked this source code somewhere here on forum) public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context context; private List<String> listDataHeader; private HashMap<String, List<String>> listDataChild; public ExpandableListAdapter(Context context, List<String> listDataHeader,

Why drawable color filter is applied in all places?

你说的曾经没有我的故事 提交于 2019-12-22 08:09:43
问题 In a section of my app I need my drawable R.drawable.blah to be filtered to white color (originally is red), so I have this method: public final static Drawable getFilteredDrawable(Context context, @DrawableRes int drawable, @ColorRes int color) { Drawable d = ContextCompat.getDrawable(context, drawable); d.setColorFilter(ContextCompat.getColor(context, color), PorterDuff.Mode.SRC_IN); return d; } and I use it this way: DrawableUtil.getFilteredDrawable(this, R.drawable.blah, android.R.color

Picasso onBitmapLoaded never called

前提是你 提交于 2019-12-22 07:08:58
问题 I am having the same problem, that I want to use the drawables that are generated by the Picasso for Image Caching Purpose, but I am not able to get the same. Here is the code which I am using to access the Bitmap Drawables : Target targetBitmap = new Target() { @Override public void onPrepareLoad(Drawable arg0) { } @Override public void onBitmapLoaded(Bitmap arg0, Picasso.LoadedFrom arg1) { mBitmap = arg0; BitmapDrawable d = new BitmapDrawable(context.getResources(), arg0); int margin = 2;

Ant Build AAPT Crunch is stripping draw9 information from Library resource images

自作多情 提交于 2019-12-22 05:57:09
问题 I have a project that is using a library project. The Library Project has draw9 (9.png) files and when building the apk via Ant it is stripping the draw9 info on scaleable and fillable areas. The result is that the app just stretches the images without using draw9 info. In Android's build.xml <target name="-package-resources" depends="-crunch"> this is calling crunch, which updates the pre-processed PNG cache (anyone know where this cache is held?). -crunch runs a task in aapt called crunch.

What is the ID of the back arrow drawable in the ActionBar?

馋奶兔 提交于 2019-12-22 04:59:32
问题 The following code causes a back arrow to appear in the ActionBar: getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); I'm looking for the resource ID of the arrow drawable, i.e. android.R.drawable.xxx. The reason I need this ID is so that I can manually set an identical arrow (size & colour) elsewhere in my app. I tried making my own drawable and using that but the size was different from the one in the ActionBar. 回答1: If you have the

Apply many color filters to the same drawable

那年仲夏 提交于 2019-12-22 04:49:22
问题 I want to apply several color filters in chain to a drawable. Is that possible? Or maybe to create a filter that is the combination of the filters I want to apply. For example, I would like: Drawable d = ...; d.setColorFilter(0x3F000000, Mode.OVERLAY).setColorFilter(0xFF2D2D2D, Mode.SCREEN) 回答1: This is the approach I ended using: Manipulate the Drawable bitmap on a Canvas and apply as many layers as I need, using Paint , it works not only for color filters, but also for any kind of image

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=