activity_main.xml does not show layout, shows only a small English key icon and the message: "Toogle tools visibility and position"

Asked

Viewed 20 times

-2

This is a program I did some time ago. A simple calculator. I searched for options for viewing Android Studio, but it seems program thing.

<?xml version="1.0" encoding="utf-8"?>
<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"
    tools:context=".MainActivity"
    tools:visibility="visible"
    tools:verticalScrollbarPosition="defaultPosition">



    <Button
        android:id="@+id/btnNum0"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="36dp"
        android:layout_marginTop="32dp"
        android:enabled="false"
        android:onClick="num0"
        android:text="@string/btn0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnNum1" />

    <Button
        android:id="@+id/btnNumMenos"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="40dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="numMenos"
        android:text="@string/btnMenos"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnNumMais" />

    <Button
        android:id="@+id/btnNum1"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="36dp"
        android:layout_marginTop="40dp"
        android:enabled="false"
        android:onClick="num1"
        android:text="@string/btn1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnNum4" />

    <Button
        android:id="@+id/btnNum3"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="40dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="num3"
        android:text="@string/btn3"
        app:layout_constraintEnd_toStartOf="@+id/btnNumDivide"
        app:layout_constraintTop_toBottomOf="@+id/btnNum6" />

    <Button
        android:id="@+id/btnNumIgual"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="32dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="numIgual"
        android:text="@string/btnIgual"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnNumDivide" />

    <Button
        android:id="@+id/btnNumBk"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="32dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="numBack"
        android:text="@string/btnBack"
        app:layout_constraintEnd_toStartOf="@+id/btnNumIgual"
        app:layout_constraintTop_toBottomOf="@+id/btnNum3" />

    <Button
        android:id="@+id/btnNumPorcento"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="44dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="numPorcento"
        android:text="@string/btnPorcento"
        app:layout_constraintEnd_toStartOf="@+id/btnNumVezes"
        app:layout_constraintTop_toBottomOf="@+id/Caixa" />

    <Button
        android:id="@+id/btnNumClr"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="44dp"
        android:layout_marginTop="44dp"
        android:enabled="false"
        android:onClick="onLimpa"
        android:text="@string/btnLimpa"
        app:layout_constraintStart_toEndOf="@+id/btnLiga"
        app:layout_constraintTop_toBottomOf="@+id/Caixa" />

    <Button
        android:id="@+id/btnNum7"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="36dp"
        android:layout_marginTop="48dp"
        android:enabled="false"
        android:onClick="num7"
        android:text="@string/btn7"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnLiga" />

    <Button
        android:id="@+id/btnLiga"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="36dp"
        android:layout_marginTop="44dp"
        android:onClick="CalcLigar"
        android:text="@string/btnOn"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/Caixa" />

    <Button
        android:id="@+id/btnNum4"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="36dp"
        android:layout_marginTop="40dp"
        android:enabled="false"
        android:onClick="num4"
        android:text="@string/btn4"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnNum7" />

    <Button
        android:id="@+id/btnNum5"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="44dp"
        android:layout_marginTop="40dp"
        android:enabled="false"
        android:onClick="num5"
        android:text="@string/btn5"
        app:layout_constraintStart_toEndOf="@+id/btnNum4"
        app:layout_constraintTop_toBottomOf="@+id/btnNum8" />

    <Button
        android:id="@+id/btnNum8"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="44dp"
        android:layout_marginTop="48dp"
        android:enabled="false"
        android:onClick="num8"
        android:text="@string/btn8"
        app:layout_constraintStart_toEndOf="@+id/btnNum7"
        app:layout_constraintTop_toBottomOf="@+id/btnNumClr" />

    <Button
        android:id="@+id/btnNum2"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="44dp"
        android:layout_marginTop="40dp"
        android:enabled="false"
        android:onClick="num2"
        android:text="@string/btn2"
        app:layout_constraintStart_toEndOf="@+id/btnNum1"
        app:layout_constraintTop_toBottomOf="@+id/btnNum5" />

    <Button
        android:id="@+id/btnNumVezes"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="44dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="numVezes"
        android:text="@string/btnVezes"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/Caixa" />

    <Button
        android:id="@+id/btnNumMais"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="48dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="numMais"
        android:text="@string/btnMais"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnNumVezes" />

    <Button
        android:id="@+id/btnNumDivide"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="40dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="numDivide"
        android:text="@string/btnDivide"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnNumMenos" />

    <Button
        android:id="@+id/btnNum6"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="40dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="num6"
        android:text="@string/btn6"
        app:layout_constraintEnd_toStartOf="@+id/btnNumMenos"
        app:layout_constraintTop_toBottomOf="@+id/btnNum9" />

    <Button
        android:id="@+id/btnNum9"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginTop="48dp"
        android:layout_marginEnd="36dp"
        android:enabled="false"
        android:onClick="num9"
        android:text="@string/btn9"
        app:layout_constraintEnd_toStartOf="@+id/btnNumMais"
        app:layout_constraintTop_toBottomOf="@+id/btnNumPorcento" />

    <Button
        android:id="@+id/btnNumPonto"
        android:layout_width="55dp"
        android:layout_height="49dp"
        android:layout_marginStart="44dp"
        android:layout_marginTop="32dp"
        android:onClick="numPonto"
        android:text="@string/btnPonto"
        app:layout_constraintStart_toEndOf="@+id/btnNum0"
        app:layout_constraintTop_toBottomOf="@+id/btnNum2" />

    <EditText
        android:id="@+id/Caixa"
        android:layout_width="364dp"
        android:layout_height="70dp"
        android:layout_marginTop="40dp"
        android:autofillHints=""
        android:ems="10"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:gravity="center"
        android:hint="@string/StrDica"
        android:inputType="textPersonName"
        android:text="@string/Caixa"
        android:textSize="30sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

1 answer

0

I found the solution:

I used Edittext but, I don’t know why, it didn’t work in the new version of Android Studio. I changed Edittext to:

<EditText
    android:id="@+id/Caixa"
    android:layout_width="0dp"
    android:layout_height="71dp"
    android:layout_marginTop="32dp"
    android:ems="10"
    android:inputType="number"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:gravity="center"
    android:hint="@string/StrDica"
    android:text="@string/Caixa"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

After this edition, my Layout appeared again. I actually created a new layout, copied and pasted the XML and realized it had the same result. I started copying item by item until I found which one was bugging my layout.

Thank you. Ricardo

Browser other questions tagged

You are not signed in. Login or sign up in order to post.