Olá pessoal, alguém poderia me ajudar? Os nomes dos alunos estão sobrepostos no emulador. Segue o código:
public class MainActivity extends Activity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
List<String> alunos = new ArrayList<>(Arrays.asList("Matheus eli","Catarina", "Sofia"));
TextView primeiroaluno = findViewById(R.id.textView);
TextView segundoaluno = findViewById(R.id.textView2);
TextView terceiroaluno = findViewById(R.id.textView3);
primeiroaluno.setText(alunos.get(0));
segundoaluno.setText(alunos.get(1));
terceiroaluno.setText(alunos.get(2));
}
}
activity_main.xml:
<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">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Matheus Eli"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="16dp" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="54dp" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="catarina"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="92dp" />
</androidx.constraintlayout.widget.ConstraintLayout>