WEB开发网
开发学院手机开发Android 开发 通过改写ArrayAdapter 用AutoCompleteTextView 实... 阅读

通过改写ArrayAdapter 用AutoCompleteTextView 实现汉字和拼音双向关联

 2010-07-15 20:43:00 来源:WEB开发网   
核心提示:具体看代码:public class CityAdapter extends BaseAdapter implements Filterable {/*** Contains the list of objects that represent the data of this ArrayAdapter.* The c

具体看代码:

public class CityAdapter extends BaseAdapter implements Filterable {

/**

* Contains the list of objects that represent the data of this ArrayAdapter.

* The content of this list is referred to as "the array" in the documentation.

*/

private List mObjects;

private List mObjects2;

/**

* Lock used to modify the content of {@link #mObjects}. Any write operation

* performed on the array should be synchronized on this lock. This lock is also

* used by the filter (see {@link #getFilter()} to make a synchronized copy of

* the original array of data.

*/

private final Object mLock = new Object();

/**

* The resource indicating what views to inflate to display the content of this

* array adapter.

*/

private int mResource;

/**

* The resource indicating what views to inflate to display the content of this

* array adapter in a drop down widget.

*/

private int mDropDownResource;

/**

* If the inflated resource is not a TextView, {@link #mFieldId} is used to find

* a TextView inside the inflated views hierarchy. This field must contain the

* identifier that matches the one defined in the resource file.

*/

private int mFieldId = 0;

/**

* Indicates whether or not {@link #notifyDataSetChanged()} must be called whenever

* {@link #mObjects} is modified.

*/

private boolean mNotifyOnChange = true;

private Context mContext;

private ArrayList mOriginalValues;

private ArrayFilter mFilter;

private LayoutInflater mInflater;

/**

* Constructor

*

1 2 3 4 5 6  下一页

Tags:通过 改写 ArrayAdapter

编辑录入:coldstar [复制链接] [打 印]
赞助商链接