Question

Am running into something that I have spent hours trying to get working. I have tried searching but what stumbles me is how to search a resolution for this as it is a strange and apparently not-so-common issue?

All I want is to be able to stretch a 'dash of paint' vertically using the y-axis scalable area marked as a single pixel on the left. My 9patch file is below:

enter image description here

I have gotten this to HALF-work as can be seen (ignore the top horizontal line, this is a separate imageview):

enter image description here

As you can see, I am missing what I call the 'Non-scalable end' which is basically the static part of the 9patch file (unmarked on left y-axis scalable area)

The code in the layout is simple:

            <ImageView
            android:id="@+id/repeater"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/PlayersList"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/PlayersList"
            android:adjustViewBounds="true"
            android:scaleType="fitXY"
            android:src="@drawable/repeater" />

(file is named repeater.9.png and stored in res/drawable-xhdpi)

Note: For some reason this works exactly as required in the 9-patch tool, but doesn't seem to work in eclipse (earlier screenshot): enter image description here

Was it helpful?

Solution

Is this the effect you were looking for ?

I have attached images for all drawables let me know if it worked. You can use http://android-ui-utils.googlecode.com/hg/asset-studio/dist/nine-patches.html to generate 9 patch images instead of making it form default tools.

enter image description here

<ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@drawable/ic_example"
            android:scaleType="fitXY"
            android:contentDescription="@null"
            android:adjustViewBounds="false" />

enter image description here enter image description here enter image description here enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top