Is wrong nine patch image? - android

I brought two nine patch images from designer for action-bar list item background. But outside of item is black.
I add images in "android:itemBackground".
The below images have shadow effect.
I think the image is wrong because it has margin.
I wonder what is exact cause?
thank.
Image1:
Image2:

I think the designer intend to make shadow effect by using bg image. Because other app's overflow menu have shadow effect. But the effect is shown by framework. So I used an color drawable as background.

Related

9patch arrow shaped pics

I want to ninepatch this image.
But when I do and use it, the arrow portion is not visible properly. I have different ways bt still not gettng the sharp arrow.
try this http://romannurik.github.io/AndroidAssetStudio/nine-patches.html
and create nine patch like this so that the pointed portion should not stretch
Then you will get images like this

Layered button with transparent icon in Android

Is it possible to make layered button in Android with transparent icon throgh first layer? It looks tricky, I could make different assets but is it possible to achieve it programmatically? Example below
EDIT: Icon has no background, only border.
Seems easy enough. Save the icon as a .png file, such that anything besides the arrow outline is transparent. Then it's a simple matter of drawing one ImageView on top of another ImageView, depending on what you want.
In order to tint the arrow, use a TintableImageView as described here.

9 patch-image strange behaviour in fragment

As It was suggested in one of my questions I have to use 9-patch image with gradient for listview item background.
But when I use 9-patch image, there are still problems with gradients:
9-patch, test.9.png:
But when I left transperent line 1 px height between gradient and bottom 9-patch line, that responds for horizontal content placement it's all ok, and I have good looking gradients.
9-patch image:
And closer to see transperent line:
And it's a result:
I've got good looking gradients, but there are transparent lines, that I don't need. On the image you can see black background behind list because of this line. How to draw 9-patch image in order to have good gradients and don't have "holes" in background?
I'm using actionbarsherlock for fragments.
the Draw9patch images doesn't work well with gradients you will find some diferences displaying it in several Android OS so donĀ“t use it.
Use a GradientDrawable
Changing gradient background colors on Android at runtime
Creating Nine (9) Patch png files with Gradients

How to programatically change the color of a Drawable without coloring alpha pixels

My Drawables have a transparent background with an white icon in the middle. What I want to do is programatically color ONLY the white part and leave the transparent pixels untouched.
I've tried lots of different methods but I always end up with a Drawable that is completly colored.
Does anyone know how to go about this?
Cheers
I don't know whether it will suit your requirement, but please split the one image with two, one full background transparent image and other is single white image icon and put this on the centre of the layout and change only that imageicon's color.

Android how to set button to have transparent background but outline still there

When I set android:background="#android:color/transparent, it sets my buttons background to transparent, but the outline of the button disappears. How do I set it so that the background is transparent but there is still an outline?
You can use a custom selector that uses different nine patch image for different states of the button.
This link might be helpful
You might use this image...
I hope it helps..
One approach would be to make yourself a 9-patch that has a border but transparency in the middle.
Here is an example:
it is an 11x11 pixel square with a 2 pixel black border. If you download this png and drop it into draw9patch and add the a pixel in the middle of the left and top then include the 9patch png file in your drawables and set
android:background="#drawable/bground"
either save your 9-patch as "bground" or change that in the above line to whatever you save it as.

Categories

Resources