Text is showing through into new fragment android
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 -

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

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
add a comment |
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 -

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

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
Try to move your<TextClock>declaration in youractivity.xmlaboveFrameLayout. So Hierarchy will be [ConstraintLayout{TextClock,FrameLayout}], You dont have to change constraints, just moveFrameLayoutat the end.
– Aaditya Brahmbhatt
Nov 21 '18 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 '18 at 4:38
add a comment |
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 -

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

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

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

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
edited Nov 21 '18 at 4:28
Ishaan Javali
1,3643821
1,3643821
asked Nov 21 '18 at 4:02
john seymour john seymour
1089
1089
Try to move your<TextClock>declaration in youractivity.xmlaboveFrameLayout. So Hierarchy will be [ConstraintLayout{TextClock,FrameLayout}], You dont have to change constraints, just moveFrameLayoutat the end.
– Aaditya Brahmbhatt
Nov 21 '18 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 '18 at 4:38
add a comment |
Try to move your<TextClock>declaration in youractivity.xmlaboveFrameLayout. So Hierarchy will be [ConstraintLayout{TextClock,FrameLayout}], You dont have to change constraints, just moveFrameLayoutat the end.
– Aaditya Brahmbhatt
Nov 21 '18 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 '18 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 '18 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 '18 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 '18 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 '18 at 4:38
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 21 '18 at 4:40
Aaditya BrahmbhattAaditya Brahmbhatt
3578
3578
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Try to move your
<TextClock>declaration in youractivity.xmlaboveFrameLayout. So Hierarchy will be [ConstraintLayout{TextClock,FrameLayout}], You dont have to change constraints, just moveFrameLayoutat the end.– Aaditya Brahmbhatt
Nov 21 '18 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 '18 at 4:38