Texts don’t even appear on the button

Asked

Viewed 146 times

0

Good Afternoon!

I have the following XML:

<?xml version="1.0" encoding="utf-8"?>
<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="match_parent"
    android:orientation="vertical"
    android:padding="16dp"
    tools:context=".Principal">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
       <TextView
           android:id="@+id/tv1"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:layout_marginTop="50dp"
           android:width="200dp"
           android:textAlignment="center"
           tools:text="Logon" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="70dp"
            android:layout_height="80dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tvLogin"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:layout_marginTop="10dp"
                tools:text="Login" />

            <TextView
                android:id="@+id/tvSenha"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:layout_marginTop="10dp"
                tools:text="Senha" />
        </LinearLayout>


        <LinearLayout
            android:layout_width="280dp"
            android:layout_height="80dp"
            android:orientation="vertical">

            <EditText
                android:id="@+id/txtLogin"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="text" />

            <EditText
                android:id="@+id/txtSenha"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="textPassword" />
        </LinearLayout>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <Button
            android:id="@+id/btnLogar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            tools:text="Logar" />

    </LinearLayout>


</LinearLayout>

And the code corresponding java:

package carcleo.com.cadastro;

import android.app.Activity;
import android.os.Bundle;

public class Principal extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.principal);
    }
}

And the following layout was generated in Android Studio.

It turns out that when I compile in device (Moto G 4 Play), does not appear any TextView not even the text of the button.

Where am I going wrong?

Follow image of the form on Android Studio inserir a descrição da imagem aqui

No device, the words

Logon, Login, Password, LOG IN

Do not appear.

But it seems that the elements are there occupying the space.

  • No device has no language settings?

  • What do you mean? Is configured Portuguese Brasil. Mas, forgive me the doubt: How can this influence if it is just a text label?

  • It was just speculation, you might have some configuration in your application that would pick up the device’s language. If the language set in the device had nothing referenced in the application, the information would appear blank. Again, it was just speculation.

  • Ah! Obg. This project only has this screen, Nothing else, I’m in the b.a.bá of Android.

  • Modifies tools:text, by android:text="example"

No answers

Browser other questions tagged

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