Questions tagged [nine-patch]

A NinePatch is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background. The four corners are unscaled; the four edges are scaled in one axis, and the middle is scaled in both axes.

704 questions
20
votes
3 answers

Which folder to put 9png images to?

We use 9png mainly to reduce the size of the apk. But, I am facing a peculiar problem. I am not sure in which folder I have to place the 9pngs in. I had put them in HDPI folder. Since Android is 'clever' it looks like if I use the app in an MDPI…
Codevalley
  • 4,593
  • 7
  • 42
  • 56
19
votes
4 answers

Android - Unable to open content: file:///storage/emulated/0

I've a widget with nine-patch image background. The image was saved in /sdcard/mydir/bgs. When I try to load a image with setImageViewUri method, I've this error: Unable to open content: file:///storage/emulated/0/sdcard/mydir/bgs .. then ... open…
CeccoCQ
  • 3,746
  • 12
  • 50
  • 81
18
votes
6 answers

How to create nine-patch and use it in my App?

I want to create a nine-patch image and use that in my App but I don't know how to create it? I've searched through the Android source code on the Web and I can't seem to find any examples of this. I need a tutorial so that I can understand the…
Omid Nazifi
  • 5,235
  • 8
  • 30
  • 56
18
votes
2 answers

How to add the bubbles to textview android?

In my application, I want to set bubbles to a text view, in the text view I add the setBackgroundResource() as you can see in the code. With this code i'm getting an image like this: I want a bubble shape image like this:
Anil M H
  • 3,332
  • 5
  • 34
  • 51
16
votes
7 answers

Android / 9-patch PNG: What, if I need smth like a 11-patch PNG?

In Draw 9-patch, everything looks fine. However, my SDK says the 9-patch png is malformed. Because I have something like an 11-patch png. Because I don't want the little grabbing area to be scaled. How to get it working? The screenshot describes…
OneWorld
  • 17,512
  • 21
  • 86
  • 136
16
votes
1 answer

How to create 9 patch in Photoshop? What is 9.png encoding?

Provided utility looks bad, for example it does not allow to do "Save As", or to draw several button states with similar slicing. Is it possible to draw 9.png in photoshop? I noticed, that generated png just contains black pixels in outer edge. Is…
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
15
votes
4 answers

Android : Alignment bug in making/showing 9patch image

NinePatch: Screenshot: Layout XML:
SubOne
  • 613
  • 5
  • 19
15
votes
3 answers

Define a custom style (theme) on an Android Switch component

I'm new to Android development and also on Android theming/customization that looks to be a wide subject... I'm trying to give my Switch component a special look & feel, but I don't manage to achieve what I want, avan after looking many resources on…
TooLiPHoNe.NeT
  • 479
  • 1
  • 5
  • 22
14
votes
4 answers

Building a 9 patch drawable at runtime

I am successfully building a 9patch drawable at runtime on Android 3.0+ using the excellent gist provided by Brian Griffey (found here). Essentially I load the raw (no patches) graphic file from the network and the filename contains the cap insets…
Andre
  • 3,150
  • 23
  • 23
14
votes
1 answer

9-Patch drawable dimensions Android. How do different densities handle the non-stretched areas?

Consider the above image. - The dotted line demarcates the 9-Patch png I will slice out of a photoshop file. I need it to create a popup box. - The box incorporates a dropShadow as shown by the measuring tool in this photo. - The pink lines are…
JackMahoney
  • 3,423
  • 7
  • 32
  • 50
13
votes
5 answers

Phonegap splash screen for android: not stretched or 9patch

I have a fake splash screen that pops up when my phonegap app is launched: super.setIntegerProperty("splashscreen", R.drawable.splash); super.loadUrl("file:///android_asset/www/index.html", 500); I currently have 3 different splash.png files: hdpi,…
user1198646
  • 131
  • 1
  • 2
  • 6
13
votes
2 answers

Is it possible to use several 9 patch images inside LayerDrawable?

I want to use two nine patches inside LayerDrawable
woodshy
  • 4,085
  • 3
  • 22
  • 21
13
votes
1 answer

android 9 patch drawable xml

Is there a way to define a 9 patch drawable in an android xml file? The reason I ask, is that when you apply a scale animation to a drawable w/ a stroke on it, the stroke appears to thicken. I'd like to make the stroke stay the same size as the…
Ben
  • 16,124
  • 22
  • 77
  • 122
13
votes
7 answers

Android NinePatch .png file format?

Android NinePatch images seem to be standard .png files with extra information. Is there a spec for the format anywhere, as I'd like to be able to implement this on other platforms?
Roddy
  • 66,617
  • 42
  • 165
  • 277
12
votes
5 answers

stretch a Image like android nine-patch?

UIImage Method : - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight. Here the stretchable area is forced to be a single pixel high/wide. I can not set the stretchable area, so I want to know:…
guoxj
  • 198
  • 1
  • 1
  • 8
1
2
3
46 47