我试图将TextView
设置为读取来自算法的数字结果。我想逐行排序。这些数字现在彼此相邻。我怎样才能逐行制作它们?
我创建了一个新的自定义对话框,其中TextView
名为Peak_num,但我无法进一步对其进行排序。我希望有一个人可以帮助我。
List<Integer> List_Of_Peaks = findPeaks(String_TO_List);
dialog.setTitle("my Dialog");
dialog.setContentView(R.layout.customdialog);
dialog.show();
Log.i(TAG, "Peaks" + List_Of_Peaks);
Peaks_num = (TextView) dialog.findViewById(R.id.Peak_Num);
Peaks_num.setText(String.valueOf(List_Of_Peaks));
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/Peak_Num"
android:layout_width="159dp"
android:layout_height="wrap_content"
android:background="@drawable/back"
android:text="Peaks"
android:textColor="#040307"
android:layout_weight="1" />
答案 0 :(得分:1)
List<Integer> List_Of_Peaks = findPeaks(String_TO_List);
dialog.setTitle("my Dialog");
dialog.setContentView(R.layout.customdialog);
dialog.show();
Log.i(TAG, "Peaks" + List_Of_Peaks);
Peaks_num = (TextView) dialog.findViewById(R.id.Peak_Num);
String text="";
for(Integer integer:List_Of_Peaks)
{
text+=integer+"\n"; // split
}
Peaks_num.setText(text);