TextViews Textänderung in einer for-Schleife
Ich möchte die Texte von textViews in der for-Schleife in Android Studio in etwa so ändern:
for i = 0 ------------> textView0 setze Text "Default"
for i = 1 ------------> textView1 setze Text "Default"
for i = 2 ------------> textView2 setze Text "Default"
Ist das möglich? Ich weiß nicht, wie ich die textView-ID in der Schleife gemäß dem Wert "i" ändern soll. Kann mir jemand helfen?
Hier ist mein XML:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="--------------"
android:id="@+id/textView0"
android:layout_marginLeft="16dp"
android:layout_gravity="center_horizontal"
android:textSize="13dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="--------------"
android:id="@+id/textView1"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="16dp"
android:textSize="13dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="--------------"
android:id="@+id/textView2"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="16dp"
android:textSize="13dp" />