我是 android 新手。我今天尝试的是获取一个列表视图,将数据显示为第一行中的 3 个文本视图和第二行中的 2 个文本视图和最后一个文本视图中的 1 个文本视图。为此,我在我的代码中尝试了这个,请帮助我出去 。
我能够在所有列表视图中显示 3 行 textview 但不能显示为 3 2 1 textview 。请建议我如何做到这一点。请帮助我完成我的主要活动
ListView lview3;
ListView3Activity adapter;
private static String month[] = {"January","February","March","April","May",
"June","July","August","September",
"October","November","December"};
private static String desc[] = {"Month - 1","Month - 2","Month - 3",
"Month - 4","Month - 5","Month - 6","Month - 7",
"Month - 8","Month - 9","Month - 10","Month - 11","Month - 12"};
private static String details[] = {"Month - 1","Month - 2","Month - 3",
"Month - 4","Month - 5","Month - 6","Month - 7",
"Month - 8","Month - 9","Month - 10","Month - 11","Month - 12"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
lview3 = (ListView) findViewById(R.id.listView1);
adapter = new ListView3Activity(this, month, desc,details);
lview3.setAdapter(adapter);
lview3.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
// TODO Auto-generated method stub
Toast.makeText(this, "Title => "+month[position]+" n Description => "+desc[position], Toast.LENGTH_SHORT).show();
}
}
listView3Activity 如下