Fahad Razi
Fahad Razi

Reputation: 1

My TextView is not visible on device - why?

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:padding="30dp">

<TextView
    android:id="@+id/callInfo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:textSize="22sp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.3"
    tools:text="••••••••••" />

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.3"
    tools:text="••••••••••"
    android:layout_marginTop="60dp"
    android:textSize="42sp"
    android:background="#eeeeee"/>

<Button
    android:id="@+id/answer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Answer"
    android:background="@color/colorPrimary"
    android:textColor="#ffffff"
    app:layout_constraintBaseline_toBaselineOf="@+id/hangup"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toEndOf="@+id/hangup" />

<Button
    android:id="@+id/hangup"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hang up"
    android:background="@color/colorAccent"
    android:textColor="#ffffff"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toStartOf="@+id/answer"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/callInfo" />

</android.support.constraint.ConstraintLayout>

I'm creating a simple calling application, where item layout are image and textview inside a constraint layout. However, when I run app in android deveice, the text view is not shown on the screen. Can someone please help me out. Thanks in advance.

Upvotes: 0

Views: 154

Answers (1)

Zholoth
Zholoth

Reputation: 86

Just replace tools:text="••••••••••" with android:text="••••••••••" or set a text programmatically :-)

Upvotes: 2

Related Questions