How to keep one layout over another layout in android












-1















This is my xml I want to keep one layout over another layout.



I have progress Bar and try again Textview in same place I am doing visible and invisible Textview and Progressbar programatically, so I want keep Progressbar over try again button, but I am unable to do this.



I have searched from google that we can do using Frame layout but its not working.



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tesco_blue"
android:paddingBottom="@dimen/margin_18"
android:paddingLeft="@dimen/margin_18"
android:paddingRight="@dimen/margin_12"
android:orientation="vertical"
android:paddingTop="@dimen/margin_18">
<LinearLayout
android:id="@+id/securebarcode_error_layout_variant_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_marginLeft="@dimen/margin_56"
android:layout_marginRight="@dimen/margin_56"
android:visibility="visible"
tools:visibility="visible">

<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />

<TextView
android:id="@+id/errortitle"
style="@style/Typeface.Body.Bold.White"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@android:color/transparent"
android:gravity="center"
android:lineSpacingExtra="4sp"
tools:text="@string/pwp_network_error" />


<TextView
android:id="@+id/errordesc"
style="@style/Typeface.Body.White"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginTop="@dimen/margin_12"
android:lineSpacingExtra="8sp"
tools:text="@string/pwp_network_error_description" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
>
<ProgressBar
android:id="@+id/pwp_progressbarlayout_variant_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"


android:visibility="visible"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:indeterminateDrawable="@drawable/custom_progress_bar"/>
</FrameLayout>

<TextView
android:id="@+id/try_again"
style="@style/Typeface.Body.Bold.HighlightBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/error_button_background"
android:gravity="center"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:text="@string/Tryagain"
android:textColor="@color/fdv_pending_state_color" />


<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />


</LinearLayout>
</LinearLayout>









share|improve this question




















  • 3





    use FrameLayout its there for a reason.

    – Karan Mer
    Nov 15 '18 at 6:30






  • 1





    You need to explain what "its not working" means: stackoverflow.com/help/how-to-ask

    – dominicoder
    Nov 15 '18 at 6:31











  • @KaranMer is right. You can also use Relative Layout if you just want to play with ProgressBar

    – Ali Ahmed
    Nov 15 '18 at 6:32
















-1















This is my xml I want to keep one layout over another layout.



I have progress Bar and try again Textview in same place I am doing visible and invisible Textview and Progressbar programatically, so I want keep Progressbar over try again button, but I am unable to do this.



I have searched from google that we can do using Frame layout but its not working.



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tesco_blue"
android:paddingBottom="@dimen/margin_18"
android:paddingLeft="@dimen/margin_18"
android:paddingRight="@dimen/margin_12"
android:orientation="vertical"
android:paddingTop="@dimen/margin_18">
<LinearLayout
android:id="@+id/securebarcode_error_layout_variant_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_marginLeft="@dimen/margin_56"
android:layout_marginRight="@dimen/margin_56"
android:visibility="visible"
tools:visibility="visible">

<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />

<TextView
android:id="@+id/errortitle"
style="@style/Typeface.Body.Bold.White"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@android:color/transparent"
android:gravity="center"
android:lineSpacingExtra="4sp"
tools:text="@string/pwp_network_error" />


<TextView
android:id="@+id/errordesc"
style="@style/Typeface.Body.White"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginTop="@dimen/margin_12"
android:lineSpacingExtra="8sp"
tools:text="@string/pwp_network_error_description" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
>
<ProgressBar
android:id="@+id/pwp_progressbarlayout_variant_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"


android:visibility="visible"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:indeterminateDrawable="@drawable/custom_progress_bar"/>
</FrameLayout>

<TextView
android:id="@+id/try_again"
style="@style/Typeface.Body.Bold.HighlightBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/error_button_background"
android:gravity="center"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:text="@string/Tryagain"
android:textColor="@color/fdv_pending_state_color" />


<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />


</LinearLayout>
</LinearLayout>









share|improve this question




















  • 3





    use FrameLayout its there for a reason.

    – Karan Mer
    Nov 15 '18 at 6:30






  • 1





    You need to explain what "its not working" means: stackoverflow.com/help/how-to-ask

    – dominicoder
    Nov 15 '18 at 6:31











  • @KaranMer is right. You can also use Relative Layout if you just want to play with ProgressBar

    – Ali Ahmed
    Nov 15 '18 at 6:32














-1












-1








-1








This is my xml I want to keep one layout over another layout.



I have progress Bar and try again Textview in same place I am doing visible and invisible Textview and Progressbar programatically, so I want keep Progressbar over try again button, but I am unable to do this.



I have searched from google that we can do using Frame layout but its not working.



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tesco_blue"
android:paddingBottom="@dimen/margin_18"
android:paddingLeft="@dimen/margin_18"
android:paddingRight="@dimen/margin_12"
android:orientation="vertical"
android:paddingTop="@dimen/margin_18">
<LinearLayout
android:id="@+id/securebarcode_error_layout_variant_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_marginLeft="@dimen/margin_56"
android:layout_marginRight="@dimen/margin_56"
android:visibility="visible"
tools:visibility="visible">

<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />

<TextView
android:id="@+id/errortitle"
style="@style/Typeface.Body.Bold.White"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@android:color/transparent"
android:gravity="center"
android:lineSpacingExtra="4sp"
tools:text="@string/pwp_network_error" />


<TextView
android:id="@+id/errordesc"
style="@style/Typeface.Body.White"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginTop="@dimen/margin_12"
android:lineSpacingExtra="8sp"
tools:text="@string/pwp_network_error_description" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
>
<ProgressBar
android:id="@+id/pwp_progressbarlayout_variant_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"


android:visibility="visible"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:indeterminateDrawable="@drawable/custom_progress_bar"/>
</FrameLayout>

<TextView
android:id="@+id/try_again"
style="@style/Typeface.Body.Bold.HighlightBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/error_button_background"
android:gravity="center"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:text="@string/Tryagain"
android:textColor="@color/fdv_pending_state_color" />


<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />


</LinearLayout>
</LinearLayout>









share|improve this question
















This is my xml I want to keep one layout over another layout.



I have progress Bar and try again Textview in same place I am doing visible and invisible Textview and Progressbar programatically, so I want keep Progressbar over try again button, but I am unable to do this.



I have searched from google that we can do using Frame layout but its not working.



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tesco_blue"
android:paddingBottom="@dimen/margin_18"
android:paddingLeft="@dimen/margin_18"
android:paddingRight="@dimen/margin_12"
android:orientation="vertical"
android:paddingTop="@dimen/margin_18">
<LinearLayout
android:id="@+id/securebarcode_error_layout_variant_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_marginLeft="@dimen/margin_56"
android:layout_marginRight="@dimen/margin_56"
android:visibility="visible"
tools:visibility="visible">

<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />

<TextView
android:id="@+id/errortitle"
style="@style/Typeface.Body.Bold.White"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@android:color/transparent"
android:gravity="center"
android:lineSpacingExtra="4sp"
tools:text="@string/pwp_network_error" />


<TextView
android:id="@+id/errordesc"
style="@style/Typeface.Body.White"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginTop="@dimen/margin_12"
android:lineSpacingExtra="8sp"
tools:text="@string/pwp_network_error_description" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
>
<ProgressBar
android:id="@+id/pwp_progressbarlayout_variant_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"


android:visibility="visible"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:indeterminateDrawable="@drawable/custom_progress_bar"/>
</FrameLayout>

<TextView
android:id="@+id/try_again"
style="@style/Typeface.Body.Bold.HighlightBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/error_button_background"
android:gravity="center"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:text="@string/Tryagain"
android:textColor="@color/fdv_pending_state_color" />


<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />


</LinearLayout>
</LinearLayout>






android android-layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 17:12









James Z

11.2k71935




11.2k71935










asked Nov 15 '18 at 6:29









Bhaskar MartBhaskar Mart

126




126








  • 3





    use FrameLayout its there for a reason.

    – Karan Mer
    Nov 15 '18 at 6:30






  • 1





    You need to explain what "its not working" means: stackoverflow.com/help/how-to-ask

    – dominicoder
    Nov 15 '18 at 6:31











  • @KaranMer is right. You can also use Relative Layout if you just want to play with ProgressBar

    – Ali Ahmed
    Nov 15 '18 at 6:32














  • 3





    use FrameLayout its there for a reason.

    – Karan Mer
    Nov 15 '18 at 6:30






  • 1





    You need to explain what "its not working" means: stackoverflow.com/help/how-to-ask

    – dominicoder
    Nov 15 '18 at 6:31











  • @KaranMer is right. You can also use Relative Layout if you just want to play with ProgressBar

    – Ali Ahmed
    Nov 15 '18 at 6:32








3




3





use FrameLayout its there for a reason.

– Karan Mer
Nov 15 '18 at 6:30





use FrameLayout its there for a reason.

– Karan Mer
Nov 15 '18 at 6:30




1




1





You need to explain what "its not working" means: stackoverflow.com/help/how-to-ask

– dominicoder
Nov 15 '18 at 6:31





You need to explain what "its not working" means: stackoverflow.com/help/how-to-ask

– dominicoder
Nov 15 '18 at 6:31













@KaranMer is right. You can also use Relative Layout if you just want to play with ProgressBar

– Ali Ahmed
Nov 15 '18 at 6:32





@KaranMer is right. You can also use Relative Layout if you just want to play with ProgressBar

– Ali Ahmed
Nov 15 '18 at 6:32












3 Answers
3






active

oldest

votes


















0














Update your Layout as below - Relative Layout can do the trick



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tesco_blue"
android:paddingBottom="@dimen/margin_18"
android:paddingLeft="@dimen/margin_18"
android:paddingRight="@dimen/margin_12"
android:orientation="vertical"
android:paddingTop="@dimen/margin_18">


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


<LinearLayout
android:id="@+id/securebarcode_error_layout_variant_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_marginLeft="@dimen/margin_56"
android:layout_marginRight="@dimen/margin_56"
android:visibility="visible"
tools:visibility="visible">

<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />

<TextView
android:id="@+id/errortitle"
style="@style/Typeface.Body.Bold.White"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@android:color/transparent"
android:gravity="center"
android:lineSpacingExtra="4sp"
tools:text="@string/pwp_network_error" />


<TextView
android:id="@+id/errordesc"
style="@style/Typeface.Body.White"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginTop="@dimen/margin_12"
android:lineSpacingExtra="8sp"
tools:text="@string/pwp_network_error_description" />


<TextView
android:id="@+id/try_again"
style="@style/Typeface.Body.Bold.HighlightBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/error_button_background"
android:gravity="center"
android:paddingLeft="@dimen/cl_48"
android:paddingRight="@dimen/cl_48"
android:paddingTop="@dimen/padding_12"
android:paddingBottom="@dimen/padding_12"
android:text="@string/Tryagain"
android:textColor="@color/fdv_pending_state_color" />


<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/margin_40" />


</LinearLayout>

<ProgressBar
android:id="@+id/pwp_progressbarlayout_variant_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_centerInParent="true"
android:visibility="visible"
android:indeterminateDrawable="@drawable/custom_progress_bar"/>


</RelativeLayout>

</LinearLayout>





share|improve this answer


























  • its not working every thing is coming left side

    – Bhaskar Mart
    Nov 15 '18 at 6:44











  • updated code, Try now

    – Ali Ahmed
    Nov 15 '18 at 6:46



















2
















  1. You can simply use constraint layout in your case as basically its
    from the family of frame layout , you can implement the code below.just take your root layout as ConstraintLayout








    <TextView
    android:id="@+id/try_again"
    style="@style/Typeface.Body.Bold.HighlightBlue"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    android:background="@drawable/error_button_background"
    android:gravity="center"
    android:paddingLeft="@dimen/cl_48"
    android:paddingRight="@dimen/cl_48"
    android:paddingTop="@dimen/padding_12"
    android:paddingBottom="@dimen/padding_12"
    android:text="@string/Tryagain"
    android:textColor="@color/fdv_pending_state_color" />

    <ProgressBar
    android:id="@+id/pwp_progressbarlayout_variant_a"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintTop_toTopOf="@id/try_again"
    app:layout_constraintBottom_toBottomOf="@id/try_again"
    app:layout_constraintLeft_toLeftOf="@id/try_again"
    app:layout_constraintRight_toRightOf="@id/try_again"
    android:visibility="visible"
    android:paddingLeft="@dimen/cl_48"
    android:paddingRight="@dimen/cl_48"
    android:paddingTop="@dimen/padding_12"
    android:paddingBottom="@dimen/padding_12"
    android:indeterminateDrawable="@drawable/custom_progress_bar"/>









share|improve this answer































    0














    You have to move your try_again TextView to inside of FrameLayout so the your Progressbar will show on TextView



    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/tesco_blue"
    android:orientation="vertical"
    android:paddingLeft="@dimen/margin_18"
    android:paddingTop="@dimen/margin_18"
    android:paddingRight="@dimen/margin_12"
    android:paddingBottom="@dimen/margin_18">

    <LinearLayout
    android:id="@+id/securebarcode_error_layout_variant_a"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginLeft="@dimen/margin_56"
    android:layout_marginRight="@dimen/margin_56"
    android:orientation="vertical"
    android:visibility="visible"
    tools:visibility="visible">

    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />

    <TextView
    android:id="@+id/errortitle"
    style="@style/Typeface.Body.Bold.White"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:lineSpacingExtra="4sp"
    tools:text="@string/pwp_network_error" />


    <TextView
    android:id="@+id/errordesc"
    style="@style/Typeface.Body.White"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="@dimen/margin_12"
    android:gravity="center"
    android:lineSpacingExtra="8sp"
    tools:text="@string/pwp_network_error_description" />

    <FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center">

    <ProgressBar
    android:id="@+id/pwp_progressbarlayout_variant_a"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:indeterminateDrawable="@drawable/custom_progress_bar"
    android:paddingLeft="@dimen/cl_48"
    android:paddingTop="@dimen/padding_12"
    android:paddingRight="@dimen/cl_48"
    android:paddingBottom="@dimen/padding_12"
    android:visibility="visible" />


    <TextView
    android:id="@+id/try_again"
    style="@style/Typeface.Body.Bold.HighlightBlue"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:background="@drawable/error_button_background"
    android:gravity="center"
    android:paddingLeft="@dimen/cl_48"
    android:paddingTop="@dimen/padding_12"
    android:paddingRight="@dimen/cl_48"
    android:paddingBottom="@dimen/padding_12"
    android:text="@string/Tryagain"
    android:textColor="@color/fdv_pending_state_color" />
    </FrameLayout>


    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />




    Here it is the image what you want.



    enter image description here






    share|improve this answer
























    • Sorry </LinearLayout> closing tag is missing in the end of the layout.

      – scienticious
      Nov 15 '18 at 7:12











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313644%2fhow-to-keep-one-layout-over-another-layout-in-android%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Update your Layout as below - Relative Layout can do the trick



    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/tesco_blue"
    android:paddingBottom="@dimen/margin_18"
    android:paddingLeft="@dimen/margin_18"
    android:paddingRight="@dimen/margin_12"
    android:orientation="vertical"
    android:paddingTop="@dimen/margin_18">


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


    <LinearLayout
    android:id="@+id/securebarcode_error_layout_variant_a"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical"
    android:layout_marginLeft="@dimen/margin_56"
    android:layout_marginRight="@dimen/margin_56"
    android:visibility="visible"
    tools:visibility="visible">

    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />

    <TextView
    android:id="@+id/errortitle"
    style="@style/Typeface.Body.Bold.White"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:lineSpacingExtra="4sp"
    tools:text="@string/pwp_network_error" />


    <TextView
    android:id="@+id/errordesc"
    style="@style/Typeface.Body.White"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:gravity="center"
    android:layout_marginTop="@dimen/margin_12"
    android:lineSpacingExtra="8sp"
    tools:text="@string/pwp_network_error_description" />


    <TextView
    android:id="@+id/try_again"
    style="@style/Typeface.Body.Bold.HighlightBlue"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/error_button_background"
    android:gravity="center"
    android:paddingLeft="@dimen/cl_48"
    android:paddingRight="@dimen/cl_48"
    android:paddingTop="@dimen/padding_12"
    android:paddingBottom="@dimen/padding_12"
    android:text="@string/Tryagain"
    android:textColor="@color/fdv_pending_state_color" />


    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />


    </LinearLayout>

    <ProgressBar
    android:id="@+id/pwp_progressbarlayout_variant_a"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_centerInParent="true"
    android:visibility="visible"
    android:indeterminateDrawable="@drawable/custom_progress_bar"/>


    </RelativeLayout>

    </LinearLayout>





    share|improve this answer


























    • its not working every thing is coming left side

      – Bhaskar Mart
      Nov 15 '18 at 6:44











    • updated code, Try now

      – Ali Ahmed
      Nov 15 '18 at 6:46
















    0














    Update your Layout as below - Relative Layout can do the trick



    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/tesco_blue"
    android:paddingBottom="@dimen/margin_18"
    android:paddingLeft="@dimen/margin_18"
    android:paddingRight="@dimen/margin_12"
    android:orientation="vertical"
    android:paddingTop="@dimen/margin_18">


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


    <LinearLayout
    android:id="@+id/securebarcode_error_layout_variant_a"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical"
    android:layout_marginLeft="@dimen/margin_56"
    android:layout_marginRight="@dimen/margin_56"
    android:visibility="visible"
    tools:visibility="visible">

    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />

    <TextView
    android:id="@+id/errortitle"
    style="@style/Typeface.Body.Bold.White"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:lineSpacingExtra="4sp"
    tools:text="@string/pwp_network_error" />


    <TextView
    android:id="@+id/errordesc"
    style="@style/Typeface.Body.White"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:gravity="center"
    android:layout_marginTop="@dimen/margin_12"
    android:lineSpacingExtra="8sp"
    tools:text="@string/pwp_network_error_description" />


    <TextView
    android:id="@+id/try_again"
    style="@style/Typeface.Body.Bold.HighlightBlue"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/error_button_background"
    android:gravity="center"
    android:paddingLeft="@dimen/cl_48"
    android:paddingRight="@dimen/cl_48"
    android:paddingTop="@dimen/padding_12"
    android:paddingBottom="@dimen/padding_12"
    android:text="@string/Tryagain"
    android:textColor="@color/fdv_pending_state_color" />


    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />


    </LinearLayout>

    <ProgressBar
    android:id="@+id/pwp_progressbarlayout_variant_a"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_centerInParent="true"
    android:visibility="visible"
    android:indeterminateDrawable="@drawable/custom_progress_bar"/>


    </RelativeLayout>

    </LinearLayout>





    share|improve this answer


























    • its not working every thing is coming left side

      – Bhaskar Mart
      Nov 15 '18 at 6:44











    • updated code, Try now

      – Ali Ahmed
      Nov 15 '18 at 6:46














    0












    0








    0







    Update your Layout as below - Relative Layout can do the trick



    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/tesco_blue"
    android:paddingBottom="@dimen/margin_18"
    android:paddingLeft="@dimen/margin_18"
    android:paddingRight="@dimen/margin_12"
    android:orientation="vertical"
    android:paddingTop="@dimen/margin_18">


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


    <LinearLayout
    android:id="@+id/securebarcode_error_layout_variant_a"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical"
    android:layout_marginLeft="@dimen/margin_56"
    android:layout_marginRight="@dimen/margin_56"
    android:visibility="visible"
    tools:visibility="visible">

    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />

    <TextView
    android:id="@+id/errortitle"
    style="@style/Typeface.Body.Bold.White"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:lineSpacingExtra="4sp"
    tools:text="@string/pwp_network_error" />


    <TextView
    android:id="@+id/errordesc"
    style="@style/Typeface.Body.White"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:gravity="center"
    android:layout_marginTop="@dimen/margin_12"
    android:lineSpacingExtra="8sp"
    tools:text="@string/pwp_network_error_description" />


    <TextView
    android:id="@+id/try_again"
    style="@style/Typeface.Body.Bold.HighlightBlue"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/error_button_background"
    android:gravity="center"
    android:paddingLeft="@dimen/cl_48"
    android:paddingRight="@dimen/cl_48"
    android:paddingTop="@dimen/padding_12"
    android:paddingBottom="@dimen/padding_12"
    android:text="@string/Tryagain"
    android:textColor="@color/fdv_pending_state_color" />


    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />


    </LinearLayout>

    <ProgressBar
    android:id="@+id/pwp_progressbarlayout_variant_a"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_centerInParent="true"
    android:visibility="visible"
    android:indeterminateDrawable="@drawable/custom_progress_bar"/>


    </RelativeLayout>

    </LinearLayout>





    share|improve this answer















    Update your Layout as below - Relative Layout can do the trick



    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/tesco_blue"
    android:paddingBottom="@dimen/margin_18"
    android:paddingLeft="@dimen/margin_18"
    android:paddingRight="@dimen/margin_12"
    android:orientation="vertical"
    android:paddingTop="@dimen/margin_18">


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


    <LinearLayout
    android:id="@+id/securebarcode_error_layout_variant_a"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical"
    android:layout_marginLeft="@dimen/margin_56"
    android:layout_marginRight="@dimen/margin_56"
    android:visibility="visible"
    tools:visibility="visible">

    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />

    <TextView
    android:id="@+id/errortitle"
    style="@style/Typeface.Body.Bold.White"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:lineSpacingExtra="4sp"
    tools:text="@string/pwp_network_error" />


    <TextView
    android:id="@+id/errordesc"
    style="@style/Typeface.Body.White"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:gravity="center"
    android:layout_marginTop="@dimen/margin_12"
    android:lineSpacingExtra="8sp"
    tools:text="@string/pwp_network_error_description" />


    <TextView
    android:id="@+id/try_again"
    style="@style/Typeface.Body.Bold.HighlightBlue"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/error_button_background"
    android:gravity="center"
    android:paddingLeft="@dimen/cl_48"
    android:paddingRight="@dimen/cl_48"
    android:paddingTop="@dimen/padding_12"
    android:paddingBottom="@dimen/padding_12"
    android:text="@string/Tryagain"
    android:textColor="@color/fdv_pending_state_color" />


    <android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/margin_40" />


    </LinearLayout>

    <ProgressBar
    android:id="@+id/pwp_progressbarlayout_variant_a"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_centerInParent="true"
    android:visibility="visible"
    android:indeterminateDrawable="@drawable/custom_progress_bar"/>


    </RelativeLayout>

    </LinearLayout>






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 15 '18 at 6:46

























    answered Nov 15 '18 at 6:40









    Ali AhmedAli Ahmed

    1,3411314




    1,3411314













    • its not working every thing is coming left side

      – Bhaskar Mart
      Nov 15 '18 at 6:44











    • updated code, Try now

      – Ali Ahmed
      Nov 15 '18 at 6:46



















    • its not working every thing is coming left side

      – Bhaskar Mart
      Nov 15 '18 at 6:44











    • updated code, Try now

      – Ali Ahmed
      Nov 15 '18 at 6:46

















    its not working every thing is coming left side

    – Bhaskar Mart
    Nov 15 '18 at 6:44





    its not working every thing is coming left side

    – Bhaskar Mart
    Nov 15 '18 at 6:44













    updated code, Try now

    – Ali Ahmed
    Nov 15 '18 at 6:46





    updated code, Try now

    – Ali Ahmed
    Nov 15 '18 at 6:46













    2
















    1. You can simply use constraint layout in your case as basically its
      from the family of frame layout , you can implement the code below.just take your root layout as ConstraintLayout








      <TextView
      android:id="@+id/try_again"
      style="@style/Typeface.Body.Bold.HighlightBlue"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_constraintTop_toTopOf="parent"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      android:background="@drawable/error_button_background"
      android:gravity="center"
      android:paddingLeft="@dimen/cl_48"
      android:paddingRight="@dimen/cl_48"
      android:paddingTop="@dimen/padding_12"
      android:paddingBottom="@dimen/padding_12"
      android:text="@string/Tryagain"
      android:textColor="@color/fdv_pending_state_color" />

      <ProgressBar
      android:id="@+id/pwp_progressbarlayout_variant_a"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_constraintTop_toTopOf="@id/try_again"
      app:layout_constraintBottom_toBottomOf="@id/try_again"
      app:layout_constraintLeft_toLeftOf="@id/try_again"
      app:layout_constraintRight_toRightOf="@id/try_again"
      android:visibility="visible"
      android:paddingLeft="@dimen/cl_48"
      android:paddingRight="@dimen/cl_48"
      android:paddingTop="@dimen/padding_12"
      android:paddingBottom="@dimen/padding_12"
      android:indeterminateDrawable="@drawable/custom_progress_bar"/>









    share|improve this answer




























      2
















      1. You can simply use constraint layout in your case as basically its
        from the family of frame layout , you can implement the code below.just take your root layout as ConstraintLayout








        <TextView
        android:id="@+id/try_again"
        style="@style/Typeface.Body.Bold.HighlightBlue"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        android:background="@drawable/error_button_background"
        android:gravity="center"
        android:paddingLeft="@dimen/cl_48"
        android:paddingRight="@dimen/cl_48"
        android:paddingTop="@dimen/padding_12"
        android:paddingBottom="@dimen/padding_12"
        android:text="@string/Tryagain"
        android:textColor="@color/fdv_pending_state_color" />

        <ProgressBar
        android:id="@+id/pwp_progressbarlayout_variant_a"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toTopOf="@id/try_again"
        app:layout_constraintBottom_toBottomOf="@id/try_again"
        app:layout_constraintLeft_toLeftOf="@id/try_again"
        app:layout_constraintRight_toRightOf="@id/try_again"
        android:visibility="visible"
        android:paddingLeft="@dimen/cl_48"
        android:paddingRight="@dimen/cl_48"
        android:paddingTop="@dimen/padding_12"
        android:paddingBottom="@dimen/padding_12"
        android:indeterminateDrawable="@drawable/custom_progress_bar"/>









      share|improve this answer


























        2












        2








        2









        1. You can simply use constraint layout in your case as basically its
          from the family of frame layout , you can implement the code below.just take your root layout as ConstraintLayout








          <TextView
          android:id="@+id/try_again"
          style="@style/Typeface.Body.Bold.HighlightBlue"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintRight_toRightOf="parent"
          android:background="@drawable/error_button_background"
          android:gravity="center"
          android:paddingLeft="@dimen/cl_48"
          android:paddingRight="@dimen/cl_48"
          android:paddingTop="@dimen/padding_12"
          android:paddingBottom="@dimen/padding_12"
          android:text="@string/Tryagain"
          android:textColor="@color/fdv_pending_state_color" />

          <ProgressBar
          android:id="@+id/pwp_progressbarlayout_variant_a"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintTop_toTopOf="@id/try_again"
          app:layout_constraintBottom_toBottomOf="@id/try_again"
          app:layout_constraintLeft_toLeftOf="@id/try_again"
          app:layout_constraintRight_toRightOf="@id/try_again"
          android:visibility="visible"
          android:paddingLeft="@dimen/cl_48"
          android:paddingRight="@dimen/cl_48"
          android:paddingTop="@dimen/padding_12"
          android:paddingBottom="@dimen/padding_12"
          android:indeterminateDrawable="@drawable/custom_progress_bar"/>









        share|improve this answer















        1. You can simply use constraint layout in your case as basically its
          from the family of frame layout , you can implement the code below.just take your root layout as ConstraintLayout








          <TextView
          android:id="@+id/try_again"
          style="@style/Typeface.Body.Bold.HighlightBlue"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintRight_toRightOf="parent"
          android:background="@drawable/error_button_background"
          android:gravity="center"
          android:paddingLeft="@dimen/cl_48"
          android:paddingRight="@dimen/cl_48"
          android:paddingTop="@dimen/padding_12"
          android:paddingBottom="@dimen/padding_12"
          android:text="@string/Tryagain"
          android:textColor="@color/fdv_pending_state_color" />

          <ProgressBar
          android:id="@+id/pwp_progressbarlayout_variant_a"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintTop_toTopOf="@id/try_again"
          app:layout_constraintBottom_toBottomOf="@id/try_again"
          app:layout_constraintLeft_toLeftOf="@id/try_again"
          app:layout_constraintRight_toRightOf="@id/try_again"
          android:visibility="visible"
          android:paddingLeft="@dimen/cl_48"
          android:paddingRight="@dimen/cl_48"
          android:paddingTop="@dimen/padding_12"
          android:paddingBottom="@dimen/padding_12"
          android:indeterminateDrawable="@drawable/custom_progress_bar"/>










        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 7:05









        Sagar BhatnagarSagar Bhatnagar

        33317




        33317























            0














            You have to move your try_again TextView to inside of FrameLayout so the your Progressbar will show on TextView



            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/tesco_blue"
            android:orientation="vertical"
            android:paddingLeft="@dimen/margin_18"
            android:paddingTop="@dimen/margin_18"
            android:paddingRight="@dimen/margin_12"
            android:paddingBottom="@dimen/margin_18">

            <LinearLayout
            android:id="@+id/securebarcode_error_layout_variant_a"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="@dimen/margin_56"
            android:layout_marginRight="@dimen/margin_56"
            android:orientation="vertical"
            android:visibility="visible"
            tools:visibility="visible">

            <android.support.v4.widget.Space
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_40" />

            <TextView
            android:id="@+id/errortitle"
            style="@style/Typeface.Body.Bold.White"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:background="@android:color/transparent"
            android:gravity="center"
            android:lineSpacingExtra="4sp"
            tools:text="@string/pwp_network_error" />


            <TextView
            android:id="@+id/errordesc"
            style="@style/Typeface.Body.White"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="@dimen/margin_12"
            android:gravity="center"
            android:lineSpacingExtra="8sp"
            tools:text="@string/pwp_network_error_description" />

            <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center">

            <ProgressBar
            android:id="@+id/pwp_progressbarlayout_variant_a"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:indeterminateDrawable="@drawable/custom_progress_bar"
            android:paddingLeft="@dimen/cl_48"
            android:paddingTop="@dimen/padding_12"
            android:paddingRight="@dimen/cl_48"
            android:paddingBottom="@dimen/padding_12"
            android:visibility="visible" />


            <TextView
            android:id="@+id/try_again"
            style="@style/Typeface.Body.Bold.HighlightBlue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/error_button_background"
            android:gravity="center"
            android:paddingLeft="@dimen/cl_48"
            android:paddingTop="@dimen/padding_12"
            android:paddingRight="@dimen/cl_48"
            android:paddingBottom="@dimen/padding_12"
            android:text="@string/Tryagain"
            android:textColor="@color/fdv_pending_state_color" />
            </FrameLayout>


            <android.support.v4.widget.Space
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_40" />




            Here it is the image what you want.



            enter image description here






            share|improve this answer
























            • Sorry </LinearLayout> closing tag is missing in the end of the layout.

              – scienticious
              Nov 15 '18 at 7:12
















            0














            You have to move your try_again TextView to inside of FrameLayout so the your Progressbar will show on TextView



            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/tesco_blue"
            android:orientation="vertical"
            android:paddingLeft="@dimen/margin_18"
            android:paddingTop="@dimen/margin_18"
            android:paddingRight="@dimen/margin_12"
            android:paddingBottom="@dimen/margin_18">

            <LinearLayout
            android:id="@+id/securebarcode_error_layout_variant_a"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="@dimen/margin_56"
            android:layout_marginRight="@dimen/margin_56"
            android:orientation="vertical"
            android:visibility="visible"
            tools:visibility="visible">

            <android.support.v4.widget.Space
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_40" />

            <TextView
            android:id="@+id/errortitle"
            style="@style/Typeface.Body.Bold.White"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:background="@android:color/transparent"
            android:gravity="center"
            android:lineSpacingExtra="4sp"
            tools:text="@string/pwp_network_error" />


            <TextView
            android:id="@+id/errordesc"
            style="@style/Typeface.Body.White"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="@dimen/margin_12"
            android:gravity="center"
            android:lineSpacingExtra="8sp"
            tools:text="@string/pwp_network_error_description" />

            <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center">

            <ProgressBar
            android:id="@+id/pwp_progressbarlayout_variant_a"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:indeterminateDrawable="@drawable/custom_progress_bar"
            android:paddingLeft="@dimen/cl_48"
            android:paddingTop="@dimen/padding_12"
            android:paddingRight="@dimen/cl_48"
            android:paddingBottom="@dimen/padding_12"
            android:visibility="visible" />


            <TextView
            android:id="@+id/try_again"
            style="@style/Typeface.Body.Bold.HighlightBlue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/error_button_background"
            android:gravity="center"
            android:paddingLeft="@dimen/cl_48"
            android:paddingTop="@dimen/padding_12"
            android:paddingRight="@dimen/cl_48"
            android:paddingBottom="@dimen/padding_12"
            android:text="@string/Tryagain"
            android:textColor="@color/fdv_pending_state_color" />
            </FrameLayout>


            <android.support.v4.widget.Space
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_40" />




            Here it is the image what you want.



            enter image description here






            share|improve this answer
























            • Sorry </LinearLayout> closing tag is missing in the end of the layout.

              – scienticious
              Nov 15 '18 at 7:12














            0












            0








            0







            You have to move your try_again TextView to inside of FrameLayout so the your Progressbar will show on TextView



            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/tesco_blue"
            android:orientation="vertical"
            android:paddingLeft="@dimen/margin_18"
            android:paddingTop="@dimen/margin_18"
            android:paddingRight="@dimen/margin_12"
            android:paddingBottom="@dimen/margin_18">

            <LinearLayout
            android:id="@+id/securebarcode_error_layout_variant_a"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="@dimen/margin_56"
            android:layout_marginRight="@dimen/margin_56"
            android:orientation="vertical"
            android:visibility="visible"
            tools:visibility="visible">

            <android.support.v4.widget.Space
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_40" />

            <TextView
            android:id="@+id/errortitle"
            style="@style/Typeface.Body.Bold.White"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:background="@android:color/transparent"
            android:gravity="center"
            android:lineSpacingExtra="4sp"
            tools:text="@string/pwp_network_error" />


            <TextView
            android:id="@+id/errordesc"
            style="@style/Typeface.Body.White"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="@dimen/margin_12"
            android:gravity="center"
            android:lineSpacingExtra="8sp"
            tools:text="@string/pwp_network_error_description" />

            <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center">

            <ProgressBar
            android:id="@+id/pwp_progressbarlayout_variant_a"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:indeterminateDrawable="@drawable/custom_progress_bar"
            android:paddingLeft="@dimen/cl_48"
            android:paddingTop="@dimen/padding_12"
            android:paddingRight="@dimen/cl_48"
            android:paddingBottom="@dimen/padding_12"
            android:visibility="visible" />


            <TextView
            android:id="@+id/try_again"
            style="@style/Typeface.Body.Bold.HighlightBlue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/error_button_background"
            android:gravity="center"
            android:paddingLeft="@dimen/cl_48"
            android:paddingTop="@dimen/padding_12"
            android:paddingRight="@dimen/cl_48"
            android:paddingBottom="@dimen/padding_12"
            android:text="@string/Tryagain"
            android:textColor="@color/fdv_pending_state_color" />
            </FrameLayout>


            <android.support.v4.widget.Space
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_40" />




            Here it is the image what you want.



            enter image description here






            share|improve this answer













            You have to move your try_again TextView to inside of FrameLayout so the your Progressbar will show on TextView



            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/tesco_blue"
            android:orientation="vertical"
            android:paddingLeft="@dimen/margin_18"
            android:paddingTop="@dimen/margin_18"
            android:paddingRight="@dimen/margin_12"
            android:paddingBottom="@dimen/margin_18">

            <LinearLayout
            android:id="@+id/securebarcode_error_layout_variant_a"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="@dimen/margin_56"
            android:layout_marginRight="@dimen/margin_56"
            android:orientation="vertical"
            android:visibility="visible"
            tools:visibility="visible">

            <android.support.v4.widget.Space
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_40" />

            <TextView
            android:id="@+id/errortitle"
            style="@style/Typeface.Body.Bold.White"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:background="@android:color/transparent"
            android:gravity="center"
            android:lineSpacingExtra="4sp"
            tools:text="@string/pwp_network_error" />


            <TextView
            android:id="@+id/errordesc"
            style="@style/Typeface.Body.White"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="@dimen/margin_12"
            android:gravity="center"
            android:lineSpacingExtra="8sp"
            tools:text="@string/pwp_network_error_description" />

            <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center">

            <ProgressBar
            android:id="@+id/pwp_progressbarlayout_variant_a"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:indeterminateDrawable="@drawable/custom_progress_bar"
            android:paddingLeft="@dimen/cl_48"
            android:paddingTop="@dimen/padding_12"
            android:paddingRight="@dimen/cl_48"
            android:paddingBottom="@dimen/padding_12"
            android:visibility="visible" />


            <TextView
            android:id="@+id/try_again"
            style="@style/Typeface.Body.Bold.HighlightBlue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/error_button_background"
            android:gravity="center"
            android:paddingLeft="@dimen/cl_48"
            android:paddingTop="@dimen/padding_12"
            android:paddingRight="@dimen/cl_48"
            android:paddingBottom="@dimen/padding_12"
            android:text="@string/Tryagain"
            android:textColor="@color/fdv_pending_state_color" />
            </FrameLayout>


            <android.support.v4.widget.Space
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_40" />




            Here it is the image what you want.



            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 15 '18 at 7:06









            scienticiousscienticious

            310316




            310316













            • Sorry </LinearLayout> closing tag is missing in the end of the layout.

              – scienticious
              Nov 15 '18 at 7:12



















            • Sorry </LinearLayout> closing tag is missing in the end of the layout.

              – scienticious
              Nov 15 '18 at 7:12

















            Sorry </LinearLayout> closing tag is missing in the end of the layout.

            – scienticious
            Nov 15 '18 at 7:12





            Sorry </LinearLayout> closing tag is missing in the end of the layout.

            – scienticious
            Nov 15 '18 at 7:12


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313644%2fhow-to-keep-one-layout-over-another-layout-in-android%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Bressuire

            Vorschmack

            Quarantine