我正在使用ListView生成SimpleAdapter。我的代码如下:

ListAdapter k = new SimpleAdapter(this, val1, R.layout.mytask, new String[]{"TaskId", "heading", "status"}, new int[]{R.id.View1, R.id.View2, R.id.ViewStatus});

我的活动是SimpleAdapterMainActivity
我想要extends Activityoverride方法。我该怎么做?

最佳答案

你可以这样做:

ListAdapter k = new SimpleAdapter(...) {
    @Override
    public View getView (int position, View convertView, ViewGroup parent) {
        View view = super.getView(position, convertView, parent);
        ...
        return view;
    }
}

关于android - 如何在Android的SimpleAdapter中使用getview()?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22904495/

10-10 15:52