android-drawable

Picasso onBitmapLoaded never called

喜你入骨 提交于 2019-12-05 09:07:51
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; int border = 0; Rect r = new Rect(margin, margin, width - margin, height - margin); int imageWidth = r

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

…衆ロ難τιáo~ 提交于 2019-12-05 08:51:13
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. But I have not been able to find any information on the arguments. It seems to be taking files from the

Where to store images in Android drawables folder?

时光毁灭记忆、已成空白 提交于 2019-12-05 06:42:25
问题 I am working on Android application that should support 2.1 till latest Android OS (4.2) version. Currently I have few images to display in my image-gallery module. I need to support my app on all devices (smartphone and tablet) which support OS ranging from 2.1 to 4.2 (latest). Each image is roughly of size 368X387, 50 KB each, PNG type My workspace res contains following drawable folders: drawable-hdpi drawable-ldpi drawable-mdpi drawable-xdpi I have some confusion around In which folder

How to have badge icon at corner of a layout

*爱你&永不变心* 提交于 2019-12-05 06:07:02
I wanted to have a badge at corner of a layout . I managed to get badge inside the layout but not able to achieve at corner of it . Currently my code gives me : What i want : i want to have this badge to over right top corner of an layout . I want something like this : Toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="@dimen/toolbar_height"

Create a Shape dynamically

╄→гoц情女王★ 提交于 2019-12-05 05:51:39
I have a shape object defined in XML like below: <shape android:shape="rectangle"> <gradient android:startColor="#333" android:centerColor="#DDD" android:endColor="#333"/> <stroke android:width="1dp" android:color="#FF333333" /> </shape> I want to create an equal object in my code. I created a GradientDrawable as below: gradientDrawable1.setColors(new int[] { 0x333, 0xDDD, 0x333 }); gradientDrawable1.setOrientation(Orientation.TOP_BOTTOM); But I don't know how to create a Stroke(?) and then assign both Stroke and GradientDrawable to Shape Any idea? Example: import android.graphics.drawable

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

試著忘記壹切 提交于 2019-12-05 05:34:41
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. If you have the support library in your project, you can make a back button in any place in your applicaction like this:

How to create youtube's double-tap gesture on Android?

三世轮回 提交于 2019-12-05 02:38:00
问题 I have application with exoplayer on Android. I have create youtube's double-tap gesture to jump 10 seconds forward or backward with animation! How create this semicircle with ripple effect on double tap? Like this How to do this? 回答1: I've also wanted to implement such feature, so I wrote it myself to "copy" YouTube's behavior. It's almost the same. You can find the library here including a sample app: https://github.com/vkay94/DoubleTapPlayerView The instructions are written in the README,

Android: How to clear an EditText by cross Button in the right side

你。 提交于 2019-12-05 00:46:21
I have created an EditText for search, which contains on the left side a search icon and on the right side of icon: <EditText android:id="@+id/Search" android:layout_width="250dp" android:layout_height="wrap_content" android:drawableLeft="@android:drawable/ic_menu_search" android:drawableRight="@android:drawable/ic_delete" android:hint="Search Product .." > </EditText> I want to know how can I clear the content of EditText when I click the cross button. Thank you in advance. Paul Verest An improved answer by @aristo_sh from Handling click events on a drawable within an EditText mQueryEditText

How to have an image with a dynamic text in it, all in a drawable, like the “today” action item on Google Calendar app?

ε祈祈猫儿з 提交于 2019-12-04 23:46:10
Background Google Calendar app has an action item that dynamically change according to the current day ("today"): I'm required to do a very similar thing, but with a slightly different image that surrounds the text. The problem I did succeed to make it work, by creating a Drawable that has text and image in it (based on here ). However, I'm don't think I did it well enough : Text font might be different across devices, so might not fit well in what I wrote. Not sure if it's because of the VectorDrawable or the text, but I think the text doesn't seem so centered . Seems a bit to the left. This

Can a drawable shape have it's size set to fill_parent?

痞子三分冷 提交于 2019-12-04 23:43:48
Is it valid for a drawable shape in Android to use fill_parent for it's size? <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#666666"/> <size android:width="fill_parent" android:height="fill_parent"/> </shape> EDIT This for the background of ImageButton views. I want the icon for the button to have a circle behind it, but I don't always know what the size of the button will be (different sizes per layout). Not really. Not using a ShapeDrawable alone. If you go through the ShapeDrawable document, you will see ( you are already using