On Fri, Sep 3, 2010 at 10:32 AM, Lance Nanek <[email protected]> wrote:
> I've seen it done for fixed size buttons entirely in XML just by using
> FrameLayout, which overlaps all its children. Inside the FrameLayout
> you put the button and another layout with the content, then tweak the
> sizes/padding/margins such that the content looks like it is in the
> button when really it is above the button. The content isn't
> clickable, so touching it touches the button behind it. If I had to do
> a content sized one and couldn't figure out how to do it entirely in
> XML, I'd probably still steal the same approach, I'd just set the size
> of the button via code after the layout is sized to the content. That
> doesn't require any code merging, just managing the size of a button
> child in a custom layout subclass.

You should be able to accomplish the same trick with a RelativeLayout,
which may be easier to manage, since you can position the pieces
relative to each other, rather than having to calculate absolute
coordinates for margins with FrameLayout.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
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