我正在尝试在列表视图上显示一些数据。我的问题是我的列表视图中只显示了一项。
我在这里找到了很多主题,但没有一个对我有帮助。
我看到 getView() 方法只被调用一次(我检查了我的列表,它的大小是 178)。
这是我的代码:
public class RiverListArrayAdaptater extends ArrayAdapter<LinkedList<River>> {
    private Context context;
    private LinkedList<River> list;
    public RiverListArrayAdaptater(Context context,LinkedList<River> list) {
        super(context,R.layout.list_river);
        this.context = context;
        this.list = list;
    }
    public View getView(int pos, View convertView, ViewGroup parent) {
        // Get variables
        LayoutInflater inflater = (LayoutInflater) cont        ext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);       
        View rowView = inflater.inflate(R.layout.list_river, parent, false);
        TextView textViewName = (TextView) rowView.findViewById(R.id.name);
        TextView textViewValue = (TextView) rowView.findViewById(R.id.value);
        ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
        textViewName.setText(list.get(pos).getName());
        textViewValue.setText(list.get(pos).getDebit());
        imageView.setImageResource(R.drawable.down);
        return rowView;
    }
}
我在 onCreate() 中的代码:
    LinkedList<River> list = parser.parse(getter.getData());
            RiverListArrayAdaptater adaptater = new     RiverListArrayAdaptater(this,list);
            adaptater.notifyDataSetChanged();
            adaptater.add(list);
            list1.setAdapter(adaptater);
这里是我的两个 XML 文件:
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
     <ListView
        android:id="@+id/listRiver"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
      />
</RelativeLayout>
和:
    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="5dp" >
    <ImageView
        android:id="@+id/logo"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="5dp"
        android:contentDescription="@+id/up_or_down"
        >
    </ImageView>
    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20sp" >
    </TextView>
    <TextView
        android:id="@+id/value"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="15sp" >
    </TextView>
</LinearLayout>
谢谢你的时间...