nine-patch

9 patch image incorrectly streeched in xhdpi density

社会主义新天地 提交于 2019-12-19 10:16:55
问题 I have problems with a 9 patch image when displayed in XHDPI. It seems as there were a bug in Android because when displayed in HDPI is displayed correctly: but when displayed in XHDPI it makes a very strange effect (look at the middle of the tab that is semitransparent: It's very strange and I can't see why it'sworking this way when in XHDPI. Basically de 9 patch is a one line gradient with some transparent margin needed for the viewpager indicator: 回答1: I assume your image is saved under

Bitmap to NinePatch to New Scaled Bitmap

倾然丶 夕夏残阳落幕 提交于 2019-12-19 04:14:18
问题 My problem is this: I need to create a re-scaled bitmap created using a NinePatch. My current system creates a Bitmap from a NinePatch file. This then gets fed into a NinePatch (or NinePatchDrawable). I then need to resize it and output to another Bitmap. I have reviewed this and it helped quite a bit. Here is my current code: try { Bitmap bitmap1 = BitmapFactory.decodeStream(getAssets().open("gfx/head.9.png")); // Using NinePatch? NinePatch patch = new NinePatch(bitmap1, bitmap1

Could anyone help me with creating 9 patch image from a png image?

眉间皱痕 提交于 2019-12-18 17:01:04
问题 I am creating a chat application.I want the to convert my png image for chat bubble into a 9patch image.I used this link.... http://android-ui-utils.googlecode.com/hg/asset-studio/dist/nine-patches.html But the problem is that the chat bubble is always maintaining a minimum width even for small messages.For eg,if i type a text like "hello",it is displayed in a bubble of width much more than the message.How to create 9patch image properly ?? Here is my png image 回答1: Your 9-patch image needs

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

痴心易碎 提交于 2019-12-18 12:56:09
问题 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 failed: EACCES (Permission denied) This appears only on the the home screen and only with Nexus 10 and Nexus 7 (with latest launcher 4.4 this bug not exist). I've also have some RemoteViews on my application and all works correctly. I've also added

Loading nine-patch image as a Libgdx Scene2d Button background looks awful

落花浮王杯 提交于 2019-12-18 05:11:08
问题 I'm trying to use a Nine Patch as a background for a Libgdx Scene2d UI button. It is loading, buts it is really ugly. I can see the "meta-data" pixels, and its being stretched as if it were just a regular image (the text on the button is "Continue"): I'm loading the .9.png files directly into a (libgdx) NinePatchDrawable via a (libgdx) NinePatch like this: this.dialogButtonUp = new NinePatchDrawable( new NinePatch(new Texture(Gdx.files.internal("data/button-round.9.png")))); this

Central sources of NinePatch Images?

做~自己de王妃 提交于 2019-12-18 03:22:39
问题 Are there any central spots or collection in the net from created NinePatches? I think they are real fancy and useful things. Even if you are not a designer this can bring you great benefit and look. But I think it would be great if there would be some collections for this in the internet as they are available for icons. But I didn't found anything useful. So I ask you if know such spots or webpages? 回答1: There are a couple of blogs out there with a few images: http://ogrelab.ikratko.com

Building a 9 patch drawable at runtime

末鹿安然 提交于 2019-12-17 18:24:25
问题 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 that I need to use in order to scale the image accordingly. I then use these values with the class found above and apply the image as a background to a variety of elements (such as TextView , ImageButton , Button , ViewGroup , etc). This works

Make button background transparent using selector

我的未来我决定 提交于 2019-12-13 15:56:47
问题 Here we go. I have a button that has a non-pressed state background as transparent. As soon as the button is pressed, the background is no longer transparent (see the pics). I use nine patch for all my images. This is my selector: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/starfighterstartbtndown" android:state_pressed="true"/> <item android:drawable="@drawable/starfighterstartbtn"/> </selector

Unwanted stretching of nine-patch image for splash screen

冷暖自知 提交于 2019-12-13 08:45:05
问题 I want to use a nine-patch image to make a splash screen for my application, which should look the same (square) in both portrait and landscape orientation. My code is simple: public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.splashscreen); // more code here... } My resource file is: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:src="@drawable/launch_image" /> </item> <

Create custom background android like this chat shape

不羁的心 提交于 2019-12-13 06:14:47
问题 **How to achieve this ** i tried 9 patch there i cant make this and no direct one available 回答1: This is a job for 9-patch images. Here is one of many examples with a gradient background. The expander bars above, below, and to the sides of your image control where the image stretching can occur and where the text padding lies. Here is how to keep the callout in an arbitrary location of the image: Here is an interactive online tool for drawing the expanders and downloading the result once you