That totally makes sense (the 9 patch image).... And good idea about
using the XML for the padding, why didn't I think of that?  :)

Thanks again,

Going to get going on this now...

Kevin

On Oct 22, 3:59 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> I know this because I work on android.widget and android.view :)
>
> Anyway, you could simply set the padding programmatically but define
> all the padding values in an XML file, like a dimens.xml, and extra
> these values. This is not perfect but at least you don't hardcode your
> padding.
>
> The reason why setting an image resets the padding is because 9-patch
> images can encode padding. If missing, we assume a padding of 0.
>
>
>
> On Wed, Oct 22, 2008 at 12:40 PM, cyntacks <[EMAIL PROTECTED]> wrote:
>
> > Romain,
>
> > Awesome! Yes, I am setting the button image from within the code. I
> > will have to do this programmatically since my design requires I set
> > the image from the code. For example, my application has a "home"
> > screen with 20 buttons on it. Each button represents a "category" and
> > the user can select which categories they want to appear on the home
> > screen from a set of 40. So, I can't hard code the images in the XML,
> > they must be dynamic.
>
> > BUT, knowing this now makes me feel much better about keeping this in
> > Java, since there is no other way!!!
>
> > Thanks so much for the reply,
>
> > Kevin
>
> > PS: Did you just know this, or was this documented somewhere that I
> > missed?
>
> > Oct 22, 3:14 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> >> Are you setting the background and/or button image from your code? If
> >> yes, this will override the padding.
>
> >> On Wed, Oct 22, 2008 at 12:12 PM, cyntacks <[EMAIL PROTECTED]> wrote:
>
> >> > Hi everyone, just wanted to give this a bump. Anyone have this
> >> > problem? I really would like to include the padding in the XML so that
> >> > the correct padding is loaded with the correct layout auto-magically.
> >> > But without this I have to have this in the source....
>
> >> > On Oct 21, 8:02 pm, cyntacks <[EMAIL PROTECTED]> wrote:
> >> >> Hi,
>
> >> >> This is a strange issue and I can't seem to figure out why it is
> >> >> happening. I have a set of ImageButtons in my xml Layout (inside of a
> >> >> Table/Row) which require padding. Here is a sample button:
>
> >> >> [code]
> >> >>         <ImageButton android:id="@+id/icon1" />
> >> >> [/code]
>
> >> >> I attempt to add padding to all 4 edges, like so:
>
> >> >> [code]
> >> >>         <ImageButton android:id="@+id/icon1"  android:padding="5sp" />
> >> >> [/code]
>
> >> >> But it doesn't work. BUT, if I add the padding to the button
> >> >> dynamically in the source, it does work. Like so:
>
> >> >> [code]
> >> >>         button.setPadding(5, 2, 5, 2);
> >> >> [/code]
>
> >> >> Any ideas what is going on here? This is killing me because the last
> >> >> thing I want to do is have the padding configured in the source, then
> >> >> it would have to be the same for each layout or I would have to add
> >> >> overhead into the code...
>
> >> >> As always, thanks for the help,
>
> >> >> Kevin
>
> >> --
> >> Romain Guywww.curious-creature.org
>
> --
> Romain Guywww.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to