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 java match:
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 happens that when I compile in device
(Moto G 4 Play), no TextView
or even button text appears.
Where am I going wrong?
Follow form image in Android Studio
In the device, the words
Logon, Login, Password, LOGAR
They do not appear.
But it looks like the elements are there occupying space.