0

we wanna use png-images as background in a selector:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@drawable/inputfield_text_bg_active" />
    <item android:drawable="@drawable/inputfield_text_bg" />
</selector>

where inputfield_text_bg_active and inputfield_text_bg are our png-images

And there is the problem with stretching, it doesn't look nice.

Is there a way to use this pngs without converting them to 9-patch-png?

Tima
  • 12,765
  • 23
  • 82
  • 125
  • why not use a nine patch? you could use a nine patch which scales horizontally. – Anthony Graglia Aug 08 '11 at 10:30
  • we don't have these images as 9-patches, so we should prepare them or better to say, send a request to change them. – Tima Aug 08 '11 at 10:47
  • You are right. The idea was (after i spoke with our iPhone-Developer), that it would be possible in Android to use normal png images. – Tima Aug 08 '11 at 11:28
  • It is. And 9 patch are also regular pngs. But really you did not provide much to begin with so it is hard to answer thoroughly. I think you have the answer though. – Anthony Graglia Aug 08 '11 at 12:45
  • i used a wrong expression. Of course it's possible to use normal pngs :) But if they are not 9-patch it's not possible to display them nice if they are stretched, is it? Our iPhone-developer can do it using some statement in his code – Tima Aug 08 '11 at 15:14

2 Answers2

0

You could try something like this:

Background in tab widget ignore scaling

Basically limit the scaling regardless of the size of the view.

Community
  • 1
  • 1
Anthony Graglia
  • 5,355
  • 5
  • 46
  • 75
-1

I think this links are helpful for u

http://developer.android.com/guide/developing/tools/draw9patch.html

http://www.android10.org/index.php/articlesother/279-draw-9-patch-tutorial

Tima
  • 12,765
  • 23
  • 82
  • 125
user4232
  • 592
  • 1
  • 12
  • 37