我试图将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" />
发布于 2016-01-12 14:36:53
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);
https://stackoverflow.com/questions/34746272
复制相似问题