*"Sounds like a LinearLayout with vertical orientation. The first item (top
image) would have a layout_weight of 0.25 and layout_gravity of
center_horizontal, the second (button) a weight of 0.75 and have
layout_gravity = center."*

I'm not sure he wants that top image to always take up 25% of the vertical
space.  It sounds to me like he wants the image to take up whatever space
it is supposed to and then have the button centered on the screen with
whatever is left.  The above solution would also cause the button's height
to take up the entire remaining space on the screen, which I don't think
was the OP's intent.

I would suggest not using layout weights and wrapping the button in a
layout (perhaps a frame layout since the button is supposed the only thing
going in there.  Something like this should work:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ImageView
        android:src="@drawable/your_image_source_goes_here"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="My Button"
            android:layout_gravity="center"/>
    </FrameLayout>
</LinearLayout>




On Sun, Apr 5, 2015 at 9:03 AM TreKing <treking...@gmail.com> wrote:

>
> On Sun, Apr 5, 2015 at 6:55 AM, NewToAndroid <rahulra...@gmail.com> wrote:
>
>> How / which layout or layouts should I use here ??
>
>
> Sounds like a LinearLayout with vertical orientation. The first item (top
> image) would have a layout_weight of 0.25 and layout_gravity of
> center_horizontal, the second (button) a weight of 0.75 and have
> layout_gravity = center.
>
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to