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

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

 2010-07-15 20:43:00 来源:WEB开发网   
核心提示:}/*** Control whether methods that change the list ({@link #add},* {@link #insert}, {@link #remove}, {@link #clear}) automatically call* {@link #notifyDataSetCh

}

/**

* Control whether methods that change the list ({@link #add},

* {@link #insert}, {@link #remove}, {@link #clear}) automatically call

* {@link #notifyDataSetChanged}. If set to false, caller must

* manually call notifyDataSetChanged() to have the changes

* reflected in the attached view.

*

* The default is true, and calling notifyDataSetChanged()

* resets the flag to true.

*

* @param notifyOnChange if true, modifications to the list will

* automatically call {@link

* #notifyDataSetChanged}

*/

public void setNotifyOnChange(boolean notifyOnChange) {

mNotifyOnChange = notifyOnChange;

}

private void init(Context context, int resource, int textViewResourceId, List objects ,List objects2) {

mContext = context;

mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

mResource = mDropDownResource = resource;

mObjects = objects;

mObjects2 = objects2;

mFieldId = textViewResourceId;

}

/**

* Returns the context associated with this array adapter. The context is used

* to create views from the resource passed to the constructor.

*

* @return The Context associated with this adapter.

*/

public Context getContext() {

return mContext;

}

/**

* {@inheritDoc}

*/

public int getCount() {

return mObjects.size();

}

/**

* {@inheritDoc}

*/

public T getItem(int position) {

return mObjects.get(position);

}

/**

* Returns the position of the specified item in the array.

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:通过 改写 ArrayAdapter

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