Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create overlay button in my Android layout

I want to create a button which will overlay between 2 layouts. I am using Linear Layout and added appropriate weight to it. Have attached a screen shot for reference.

enter image description here

Here is my XML tag.xml :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:weightSum="100" >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="30"
    android:background="@color/greyColor"
    android:gravity="center" >

    <ImageView
        android:id="@+id/ximgvwCamera"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/camera_big" />
</RelativeLayout>

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="70"
    android:background="@android:color/white" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="@android:color/white"
        android:gravity="center_horizontal"
        android:orientation="vertical" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_margin="5dp"
            android:padding="5dp"
            android:text="@string/strQ1"
            android:textAppearance="@android:style/TextAppearance.Medium"
            android:textColor="@android:color/darker_gray" />
    </LinearLayout>
</ScrollView>

Please help me in this. Thanks in advance!

like image 772
Trideep Avatar asked Mar 16 '15 09:03

Trideep


1 Answers

Try this it will working...

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

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="150dp" >

        <ImageView
            android:id="@+id/imageCover"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="fitXY"
            android:src="@drawable/image_top" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:background="@drawable/image_bottom"
        android:layout_height="match_parent" >
    </LinearLayout>
</LinearLayout>

<ImageView
    android:id="@+id/imageProfile"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_gravity="end"
    android:layout_marginTop="100dp"
    android:src="@drawable/ic_launcher" />

</FrameLayout>

View like this

enter image description here

like image 148
Jai Rajesh Avatar answered Sep 24 '22 18:09

Jai Rajesh