* Running state of which positions are currently checked
*/
SparseBooleanArray mCheckStates; 存储那些位置被选中了
/**
* Running state of which IDs are currently checked.
* If there is a value for a given key, the checked state for that ID is true
* and the value holds the last known position in the adapter for that id.
*/
LongSparseArray<Integer> mCheckedIdStates; 那些ID被选中
/**
* Controls how the next layout will happen
*/
int mLayoutMode = LAYOUT_NORMAL;当前显示模式
/**
* Should be used by subclasses to listen to changes in the dataset
*/
AdapterDataSetObserver mDataSetObserver;由子类使用来监听数据库的改变
/**
* The adapter containing the data to be displayed by this view
*/
ListAdapter mAdapter; 包含被展示在这个view上的数据
/**
* The remote adapter containing the data to be displayed by this view to be set
*/
private RemoteViewsAdapter mRemoteAdapter; 包含数据的远程adapter展示在这个视图上,remoteview中嵌入listview时使用。
/**
* If mAdapter != null, whenever this is true the adapter has stable IDs.
*/
boolean mAdapterHasStableIds; 作用如果Adapter的hasStableIDS返回true,这样notifyDataSetChanged的时候,id不变,ListView将不会重新绘制这个view;
/**
* This flag indicates the a full notify is required when the RemoteViewsAdapter connects
*/
private boolean mDeferNotifyDataSetChanged = false;这个flag表明一个完全的通知是需要当RemoteViewsAdapter连接时。
本文解析了ListView中的状态管理机制,包括选中状态的存储方式、布局模式控制、数据集变化监听、适配器使用及远程适配器特性等。特别介绍了SparseBooleanArray和LongSparseArray在存储位置和ID选中状态的应用。
807

被折叠的 条评论
为什么被折叠?



