关于 arrayAdapter
我的应用程序中有一个带有适配器的 ListView,我用它来显示带有 checkbox 和 textView 的列表>
public class MyListAdapter extends ArrayAdapter<Model> {
private LayoutInflater inflater;
private int position;
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public MyListAdapter (Context context, List<Model> listMeasurement){
super(context, R.layout.simplerow, R.id.empty, listMeasurement);
inflater= LayoutInflater.from(context);
}
public View getView(int position, View convertView, ViewGroup parent){
Model model= (Model)this.getItem(position);
CheckBox checkBox;
TextView textView;
}
}
我的问题是:
我想在另一个 activity
中显示另一个 list
,这将有一个 image
、两个 textViews
> 和一个按钮
。图像取决于 textView
的值。
最好的方法是做其他ArrayAdapter
?或使用其他东西?
提前致谢。
I have in my app a ListView
with adapter
, I use this to show a list with a chechbox
and a textView
public class MyListAdapter extends ArrayAdapter<Model> {
private LayoutInflater inflater;
private int position;
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public MyListAdapter (Context context, List<Model> listMeasurement){
super(context, R.layout.simplerow, R.id.empty, listMeasurement);
inflater= LayoutInflater.from(context);
}
public View getView(int position, View convertView, ViewGroup parent){
Model model= (Model)this.getItem(position);
CheckBox checkBox;
TextView textView;
}
}
My question is:
I want to show another list
in another activity
, this will have an image
, two textViews
and a button
. The image depends on the value of the textView
.
The best way to do this is do other ArrayAdapter
? or use other things?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要扩展
BaseAdapter
并重写getView()
方法。这是一个示例。You need to extend the
BaseAdapter
and override thegetView()
method. Here is a sample.