Text is showing through into new fragment android











up vote
0
down vote

favorite












I'm new to Android and I'm making an alarm clock for practice. I have my MainActivity which shows a digital clock like this -



enter image description here



The add sign in the top right corner opens a new fragment to be able to set a new alarm but the problem is that the white digital clock text (shown in the first image) is peaking through into my fragment. I have tried to follow other suggestions that I've found on here such as setting the background to white on the fragment and also setting statelistanimator to @null but nothing has changed it. Here is the image(the overlap is on the text)-



enter image description here



Here is the XML for the fragment. (I have included only the parts that I believe are relevant, but i could be wrong).



 <androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:clickable="true"
android:focusable="true"
tools:context=".SetAlarmFragment">


<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:text="Choose a time"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />


and here is the activity XML.



    <androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@color/colorPrimary"
tools:context=".MainActivity">

<FrameLayout
android:id="@+id/fragmentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

</FrameLayout>

<TextClock
android:id="@+id/textClock"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="@font/digital"
android:textAlignment="center"
android:textColor="@color/design_default_color_background"
android:textSize="50sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/completeAlarmSetUp"
tools:text="12:30:01" />


Any help would be appreciated as well as any documentation that I can follow.



Thanks










share|improve this question
























  • Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You dont have to change constraints, just move FrameLayout at the end.
    – Aaditya Brahmbhatt
    Nov 21 at 4:30












  • @AadityaBrahmbhatt Hit the nail on the head, i feel so stupid!! please answer the question and ill mark it correct. thanks again!
    – john seymour
    Nov 21 at 4:38















up vote
0
down vote

favorite












I'm new to Android and I'm making an alarm clock for practice. I have my MainActivity which shows a digital clock like this -



enter image description here



The add sign in the top right corner opens a new fragment to be able to set a new alarm but the problem is that the white digital clock text (shown in the first image) is peaking through into my fragment. I have tried to follow other suggestions that I've found on here such as setting the background to white on the fragment and also setting statelistanimator to @null but nothing has changed it. Here is the image(the overlap is on the text)-



enter image description here



Here is the XML for the fragment. (I have included only the parts that I believe are relevant, but i could be wrong).



 <androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:clickable="true"
android:focusable="true"
tools:context=".SetAlarmFragment">


<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:text="Choose a time"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />


and here is the activity XML.



    <androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@color/colorPrimary"
tools:context=".MainActivity">

<FrameLayout
android:id="@+id/fragmentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

</FrameLayout>

<TextClock
android:id="@+id/textClock"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="@font/digital"
android:textAlignment="center"
android:textColor="@color/design_default_color_background"
android:textSize="50sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/completeAlarmSetUp"
tools:text="12:30:01" />


Any help would be appreciated as well as any documentation that I can follow.



Thanks










share|improve this question
























  • Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You dont have to change constraints, just move FrameLayout at the end.
    – Aaditya Brahmbhatt
    Nov 21 at 4:30












  • @AadityaBrahmbhatt Hit the nail on the head, i feel so stupid!! please answer the question and ill mark it correct. thanks again!
    – john seymour
    Nov 21 at 4:38













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm new to Android and I'm making an alarm clock for practice. I have my MainActivity which shows a digital clock like this -



enter image description here



The add sign in the top right corner opens a new fragment to be able to set a new alarm but the problem is that the white digital clock text (shown in the first image) is peaking through into my fragment. I have tried to follow other suggestions that I've found on here such as setting the background to white on the fragment and also setting statelistanimator to @null but nothing has changed it. Here is the image(the overlap is on the text)-



enter image description here



Here is the XML for the fragment. (I have included only the parts that I believe are relevant, but i could be wrong).



 <androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:clickable="true"
android:focusable="true"
tools:context=".SetAlarmFragment">


<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:text="Choose a time"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />


and here is the activity XML.



    <androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@color/colorPrimary"
tools:context=".MainActivity">

<FrameLayout
android:id="@+id/fragmentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

</FrameLayout>

<TextClock
android:id="@+id/textClock"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="@font/digital"
android:textAlignment="center"
android:textColor="@color/design_default_color_background"
android:textSize="50sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/completeAlarmSetUp"
tools:text="12:30:01" />


Any help would be appreciated as well as any documentation that I can follow.



Thanks










share|improve this question















I'm new to Android and I'm making an alarm clock for practice. I have my MainActivity which shows a digital clock like this -



enter image description here



The add sign in the top right corner opens a new fragment to be able to set a new alarm but the problem is that the white digital clock text (shown in the first image) is peaking through into my fragment. I have tried to follow other suggestions that I've found on here such as setting the background to white on the fragment and also setting statelistanimator to @null but nothing has changed it. Here is the image(the overlap is on the text)-



enter image description here



Here is the XML for the fragment. (I have included only the parts that I believe are relevant, but i could be wrong).



 <androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:clickable="true"
android:focusable="true"
tools:context=".SetAlarmFragment">


<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:text="Choose a time"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />


and here is the activity XML.



    <androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@color/colorPrimary"
tools:context=".MainActivity">

<FrameLayout
android:id="@+id/fragmentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

</FrameLayout>

<TextClock
android:id="@+id/textClock"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="@font/digital"
android:textAlignment="center"
android:textColor="@color/design_default_color_background"
android:textSize="50sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/completeAlarmSetUp"
tools:text="12:30:01" />


Any help would be appreciated as well as any documentation that I can follow.



Thanks







android xml android-fragments






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 4:28









Ishaan

514116




514116










asked Nov 21 at 4:02









john seymour

1089




1089












  • Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You dont have to change constraints, just move FrameLayout at the end.
    – Aaditya Brahmbhatt
    Nov 21 at 4:30












  • @AadityaBrahmbhatt Hit the nail on the head, i feel so stupid!! please answer the question and ill mark it correct. thanks again!
    – john seymour
    Nov 21 at 4:38


















  • Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You dont have to change constraints, just move FrameLayout at the end.
    – Aaditya Brahmbhatt
    Nov 21 at 4:30












  • @AadityaBrahmbhatt Hit the nail on the head, i feel so stupid!! please answer the question and ill mark it correct. thanks again!
    – john seymour
    Nov 21 at 4:38
















Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You dont have to change constraints, just move FrameLayout at the end.
– Aaditya Brahmbhatt
Nov 21 at 4:30






Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You dont have to change constraints, just move FrameLayout at the end.
– Aaditya Brahmbhatt
Nov 21 at 4:30














@AadityaBrahmbhatt Hit the nail on the head, i feel so stupid!! please answer the question and ill mark it correct. thanks again!
– john seymour
Nov 21 at 4:38




@AadityaBrahmbhatt Hit the nail on the head, i feel so stupid!! please answer the question and ill mark it correct. thanks again!
– john seymour
Nov 21 at 4:38












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You don't have to change constraints, just move FrameLayout at the end.






share|improve this answer





















    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',
    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%2f53405097%2ftext-is-showing-through-into-new-fragment-android%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You don't have to change constraints, just move FrameLayout at the end.






    share|improve this answer

























      up vote
      1
      down vote



      accepted










      Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You don't have to change constraints, just move FrameLayout at the end.






      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You don't have to change constraints, just move FrameLayout at the end.






        share|improve this answer












        Try to move your <TextClock> declaration in your activity.xml above FrameLayout. So Hierarchy will be [ConstraintLayout{TextClock , FrameLayout}], You don't have to change constraints, just move FrameLayout at the end.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 at 4:40









        Aaditya Brahmbhatt

        2568




        2568






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405097%2ftext-is-showing-through-into-new-fragment-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

            Berounka

            Sphinx de Gizeh

            Different font size/position of beamer's navigation symbols template's content depending on regular/plain...