9-patch background image affects margins?

by Jason Proctor » Tue, 16 Feb 2010 08:16:57 GMT

Sponsored Links
 i have list views with image views and text views etc in them, and 
i'm trying to fix up a situation where the background image of a list 
element changes in the "pressed" state.

if there's a straightforward way of doing that, please let me know!

right now, i override onTouchEvent() in the topmost view, and also in 
those child views who don't just delegate to their parents -- which 
would be image views. i have to check for long clicks myself, but 
basically this scheme works.

the list views are potentially different sizes depending on how much 
text is in the views etc, so i thought i would use a 9-patch as the 
background. however, when the background changes from flat white to 
the 9-patch, this seems to indent the view a bit -- ie give it 

eh? if i change the image to a non-9-patch, the margins remain as 
they are. i've tried different sizes of 9-patch, from 320x150 or so 
down to 100x30 etc, no change.

what's going on?



9-patch background image affects margins?

by skink » Tue, 16 Feb 2010 16:06:14 GMT

 On Feb 16, 1:16am, Jason Proctor <jason.android.li...@gmail.com>

9patches affect padding (see bottom & right black control lines)



Sponsored Links

9-patch background image affects margins?

by Jason Proctor » Wed, 17 Feb 2010 02:50:55 GMT

9patches affect padding (see bottom & right black control lines) pskink
great - thanks! -- jason.vp.engineering.particle --

Other Threads

1. Search Invoke sample

Question on the API demo - Search Invoke

I launched this sample and have selected "Automatic" in the spinner. I
also see a menu option "Automatic". When this menu option is selected,
it pops an alert that says "To invoke search try menu+S"

However, menu+S doesn't bring the search dialog.  Any issues?

2. Hide Emulator Keyboard

Hello Felix,

You can easily change the default skin of the emulator to a skin which
does not have a keyboard at all.

This link will help you for this;



3. ListView and custom rows containing EditText

4. Problem with basic Map application

5. getScale replacement for BaseAdapter in 0.9 beta?

6. Bug in Bitmap.compress when used on JPEGs?

7. How to use the mic for audio-input in android