int n = Integer.parseInt(String.valueOf(txt.getText()));
for(int i = 1; i <= 10; i++)
{
txtview.setText(n+" "+i+"s are "+n*i);
}
輸入來自由按鈕觸發的editText。試圖在TextView中打印數學表格。它唯一打印最後一行的表格?
這裏是TextView的:
<TextView
android:id="@+id/textView"
android:layout_width="395dp"
android:layout_height="264dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:text="Hey! what's up?"
android:textSize="20dp"
android:singleLine="false"
android:inputType="textEmailAddress|textMultiLine"
android:lines="20"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
,因爲你只設置最後一行放入textview –