我正在从 excel 表中读取 10 行(每个单元格分别)并将其显示在ListView
. 但我有一个想法:ListView
我不想在 a 中显示它,而是在 a 中textView
随机显示。这是显示在ListView
我想要它的代码textView
请帮助我
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import android.os.Bundle;
import android.app.Activity;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends Activity {
ListView lv;
Readme r;
InputStream ims;
ArrayList<String> a123 = new ArrayList<String>();
ArrayAdapter<String> ad;
List<MyCustomPage> uuu = new ArrayList<MyCustomPage>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//tv=(TextView)findViewById(R.id.textView1);
lv = (ListView)findViewById(R.id.listView1);
r = new Readme();
ims = getResources().openRawResource(R.raw.tips);
r.setInputFile(ims);
try {
System.out.println("t1");
uuu = r.read();
System.out.println("t4");
} catch (Exception e) {
e.printStackTrace();
}
for (MyCustomPage m : uuu) {
a123.add(m.getUserquate().trim());
}
ad = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, a123);
lv.setAdapter(ad);
}
}
`