в Strings.xml содержится массив данных, которые нужно вывести в listview с названием creatorList. настройки ListView:
<ListView
android:id="@+id/creatorList"
android:textColor="#1031D3"
android:layout_width="407dp"
android:layout_height="635dp"
app:layout_constraintBottom_toTopOf="@+id/version"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/Creator" />
код в MainActivity.jar ListView creatorList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buttonCreator = (Button) findViewById(R.id.buttonCreator);
buttonCreator.setOnClickListener(this);
ListView creatorList = findViewById(R.id.creatorList);
String[] creator = getResources().getStringArray(R.array.creator);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
android.R.layout.simple_list_item_1, creator);
creatorList.setAdapter(adapter);
}
данный ListView нужно привязать к Activity - Activity_creator.xml
Activiti_Main.xml
<?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">
<Button
android:id="@+id/buttonStart"
android:layout_width="143dp"
android:layout_height="60dp"
android:text="Start"
app:backgroundTint="#1031D3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.932" />
<Button
android:id="@+id/buttonCreator"
android:layout_width="277dp"
android:layout_height="43dp"
android:text="Creator"
app:layout_constraintBottom_toTopOf="@+id/buttonStart"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.059"
app:backgroundTint="#1031D3"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
Активити на котором находится listview:
<?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=".Creator">
<TextView
android:id="@+id/Creator"
android:layout_width="252dp"
android:layout_height="39dp"
android:gravity="center"
android:text="Creator"
android:textColor="#1031D3"
android:textSize="25sp"
android:fontFamily="sans-serif-condensed"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.039"
/>
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="version 0.0.2"
android:textColor="#1031D3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
<ListView
android:id="@+id/creatorList"
android:textColor="#1031D3"
android:layout_width="407dp"
android:layout_height="635dp"
app:layout_constraintBottom_toTopOf="@+id/version"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/Creator" />
</androidx.constraintlayout.widget.ConstraintLayout>