nine-patch

Android: Distorted background for toolbar icons, list items and overflow menu

非 Y 不嫁゛ 提交于 2019-12-13 05:37:34
问题 While developing an android app, i updated android studio and also android sdk. after that, i faced strange behavior. when clicking on any item like actionbar icons, overflow menu and spinners get distorted background like picture below. my sdk versions are: Android support repository 32 Android support library 23.2.1 Android SDK tools 25.1.6 Android SDK Build-tools 23.0.2 Android 6.0 (API 23) SDK platform Rev 3 its same on emulator and usb device, and cleaning and rebuilding the project didn

Android Picasso nine patch image from url

假装没事ソ 提交于 2019-12-13 02:12:10
问题 I have a problem loading nine patch images from url into a view as the view's background. I can load nine patch images from resources which works fine. I set the target for Picasso as follows: view.setTag(new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, LoadedFrom from) { Log.d("LOG", bitmap.getWidth() + " " + bitmap.getHeight()); BitmapDrawable bitmapDrawable = new BitmapDrawable(activity.getResources(), bitmap); byte[] ninePatchChunk = bitmap.getNinePatchChunk(); if

9 patch fill area not working with multiple scale areas

这一生的挚爱 提交于 2019-12-12 18:41:54
问题 In my 9 patch I've added a fill area to be the contents taking most of the width and from below the red rectangle. However as the scale images show it's not working. If I remove the scale area shown by the arrow then it works perfectly. What am I doing wrong or not understanding about 9 patch? Thanks. 回答1: I found a related answer that explains it perfectly for me: Android nine-patch content-border not honoured The content region is defined by the right and lower bars as mentioned above, but

Center horizontally and/or vertically with 9 patch in Android

六眼飞鱼酱① 提交于 2019-12-12 17:41:55
问题 I can't find a topic talking about my problem which seems to me standard ... And that make me think it is not possible. But I give a try. I have a RelativeLayout with a 9 patch background (which contain a content area). Is that possible to center horizontally and/or vertically a TextView inside this RelativeLayout in relation to the content area ? 回答1: this layout file will do the task <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res

Android - 9 patch

点点圈 提交于 2019-12-12 14:38:48
问题 I'm trying to create a new spinner background using a 9 patch picture. I've tried many ways to get a perfect image but I failed :s Here is my 9 patch: The content looks to be good when I simulate with Draw-9-patch but the part with the arrow is not displayed, or when it is, this part is totally mal-formed. I've put the top black line to the whole size and the problem is still the same. Do you know how to solve it? Thanks. Regards. V. 回答1: First of all, you've marked your rounded corners as

Different 9-patch images for different densities?

安稳与你 提交于 2019-12-12 08:17:33
问题 I have the same 9-patch images in MDPI / HDPI / xhdpi. Is there a particular reason why it will not be saved for the smallest size? The stretchable areas scale automatically when the content is greater, for example a background as a 9-patch. Example background: mdpi: hdpi: xhdpi: 回答1: Many nine patches are so small that they normally don't need to be recreated for different screen sizes. In your example the corners of the background are not scaled. If you just use the same corners on all

Create nine-patch from bitamp - and getting new adjust bitmap

与世无争的帅哥 提交于 2019-12-12 04:38:27
问题 I'm tring to download an image from the net, and to convert it to ninepatch format, how I select the stretchable pixels is out of scope for this thread. I'm trying to use gist solution but I couldn't get it to work. This is the source code: NinePatchDrawable np = createNinePathWithCapInsets(res, bitmap, top,left, bitmap.getWidth() - right, bitmap.getHeight() - bottom, null); and to get the resulted bitmap: Bitmap outputBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

Saving run-time generated NinePatch on external memory

我的梦境 提交于 2019-12-12 01:53:40
问题 I'm following this post to create nine patch drawable at run-time. I need to save the 9patch image on the internal/external memory, so that i can easily retrieve it's URI and assign it to an ImageView for example. Does anybody know how can I achieve this? P.S. Bitmap.compress method won't work, because it will save the image as a regular (not 9patch) png file. P.S. I know that I can serialize generated NinePatch object and save it to a file. But this way I can't assign it to a RemoteViews

NinePatchDrawable from Drawable.createFromPath or FileInputStream

孤人 提交于 2019-12-12 01:28:42
问题 I cannot get a nine patch drawable to work (i.e. it is stretching the nine patch image) when loading from either Drawable.createFromPath or from a number of other methods using an InputStream. Loading the same nine patch works fine when loading from when resources. Here's the methods I am trying: Button b = (Button) findViewById(R.id.Button01); Drawable d = null; //From Resources (WORKS!) d = getResources().getDrawable(R.drawable.test); //From Raw Resources (Doesn't Work) InputStream is =

Android Dynamically setting a 9-patch background on EditText widget [duplicate]

淺唱寂寞╮ 提交于 2019-12-11 10:54:54
问题 This question already has answers here : How to programmatically re-apply a 9-patch image to an ImageView? (5 answers) Closed 6 years ago . firstly thank you for taking the time to read this. So I have created three 9-patch files which are working correctly as I can set them in XML on my registration form I've created and they look fine. The first two are set using an XML file depending on whether the EditText state_focused = 'true' or if state_focused='false'. That is working absolutely fine