Textos não aparecem nem mesmo no botão

  • Respostas:0
  • AbertoNão stickySem resposta
  • Posts no fórum: 1

15/11/2018, 13:54:52 via Web

Boa Tarde!

Tenho o seguinte XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="schemas.android.com/apk/res/android"
    xmlns:tools="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>

E o código java correspondente:

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

E o seguinte layout foi gerado no Android Studio.
image
Acontece que quando compilo no device (Moto G 4 Play), não aparece nenhum TextView nem mesmo o texto do botão.

Onde estou errando?

Seja o primeiro a responder

Artigos recomendados