goodm
goodm

Reputation: 7295

Android - ImageView scaling

Is it possible to scale ImageView only in particular part? I have a ImageView and I would like to scale it, but only the middle part. Left side and right would stay the same, stretching occur only in the middle.

Just like on the pic bellow:

enter image description here

Upvotes: 0

Views: 420

Answers (2)

Eric Schlenz
Eric Schlenz

Reputation: 2581

It sounds to me like you want to leverage 9 patch drawables. A 9 patch is just a special version of your image that has a 1px border that defines the stretchable areas. Android directly supports this, and even has a tool to create the 9 patch images. It's pretty simple.

Documentation here: http://developer.android.com/tools/help/draw9patch.html

Upvotes: 0

Boris Strandjev
Boris Strandjev

Reputation: 46943

I personally did not know that by heart but simple search showed me this result: Android - stretch image partially

Upvotes: 1

Related Questions