Listview lines disappear when scrolling

Asked

Viewed 90 times

0

I’m wearing a listview and populate it with a cursoradapter. When scrolling up and down the lines disappear. If I start with 30 elements, as I scroll up and down I get less... until I get more or less the number of lines without having to scroll.

This is my Adapter:

public class AdapterChatDetail extends CursorAdapter {

    private Context mContext;
    private int id;
    private Cursor mCursor;


    public AdapterChatDetail(Context context, Cursor c)
    {
        super(context, c, 0);
        mContext = context;
        mCursor = c;
    }

    @Override
    public View newView(Context context,  Cursor cursor, ViewGroup parent) {
        return LayoutInflater.from(context).inflate(R.layout.linha_chatdetail, parent, false);
    }

    @Override
    public void bindView(View mView, Context context, Cursor cursor) {
             ((TextView) mView.findViewById(R.id.msg1)).setText(cursor.getString(cursor.getColumnIndex(Contrato.Chat.COLUMN_MSG)));

        }
    }

And the list is defined this way

   <ListView
        android:id="@+id/lista"
        android:layout_below="@id/scroll"
        android:layout_above="@id/linha2"
        android:dividerHeight="0dp"
        android:divider="@null"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>

Any idea what might be going on?

Thank you

1 answer

0

Disable scroll caching in your list XML to see if `

 <ListView
        android:scrollingCache="false"`         
        android:id="@+id/lista"
        android:layout_below="@id/scroll"
        android:layout_above="@id/linha2"
        android:dividerHeight="0dp"
        android:divider="@null"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.