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. How to avoid jarring effect when launching an activity

Hi group,
When my app icon is clicked , a black screen is displayed  for a split
second before my main activity comes to foreground .After goggling i
found out to use Theme to avoid back screen or jarring effect .It
worked out fine.Here i can display the background of my home screen
for that split second
 <activity android:name=".MainActivity"
                <action android:name="android.intent.action.MAIN" />
android:name="android.intent.category.LAUNCHER" />

under theme.xml
    <style name="Theme.LoadingPage" parent="android:Theme">
        <item name="android:windowBackground">@drawable/
        <item name="android:windowNoTitle">true</item>

<style name="Theme.A1LoadingPage" parent="android:Theme">
        <item name="android:windowBackground">@drawable/a1_loading</
        <item name="android:windowNoTitle">true</item>

under res/drawable/background_loading.xml

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:tileMode="repeat" />

But my problem is i wanted to do the same for other activity apart
from main activity ,but i couldn't get the desired result.For
explanation , considered i started an Activity A1 on a button click
from Main Activity screen.It takes few seconds for the activity A1 to
appear.I need to display the background screen of Activity A1 as soon
as the button is clicked, this is just to fill the intermittent time
gap before A1 actually  gets displayed ,thus avoiding a standstill
kind of appearance to the user . And i tried in vain .I wonder why the
same  that has worked on launch main activity   is not working with
other activities

     <activity android:name="xx.com.A1"

Note: I have used Threads and Handlers in activity  A1  to reduce the
load on onCreate.
Please help me to find a correct solution.


2. Memento 1.3.

Now, with Google docs sync!! Bakalan jadi app favorit gw buat nyatet2 nihh..

BTW, basically this is a database app, jadi bisa buat bikin database
custom.. misalnya nyatet koleksi CD, ato nyatet nomor rekening org2..

Happily unvirgi...@nexusone-cm-

"Indonesian Android Community [id-android]" 

3. Where to begin?

4. Keeping service alive across configuration changes

5. Cara delete email gmail di android

6. Dialog box not (onClick event is not invoked) coming up while scanning for devices

7. Trying to start a thread dedicated to sending and receiving data