肯定可以再TalkBack中设置 ListView焦点停在某个item上的方法

				newMessage.viewItem.requestFocus();
				newMessage.viewItem.requestFocusFromTouch();//  2013-9-1 下午11:40:09
				listViewChat.setSelection(m_Adaptor.getCount()-1);


 

 

public class ChatMsgViewAdapter extends BaseAdapter {
    private static final String TAG = ChatMsgViewAdapter.class.getSimpleName();

    final public ArrayList<ChatMsgEntity> coll = new ArrayList<ChatMsgEntity>();

    private Context ctx;

    public ChatMsgViewAdapter(Context context) {
        ctx = context;
        //this.coll = coll;
    }

    public boolean areAllItemsEnabled() {
        return false;
    }

//    public boolean isEnabled(int arg0) {
//        return false;
//    }

    public int getCount() {
        return coll.size();
    }

    @Override
    public Object getItem(int position) {
        return coll.get(position);
    }

//    public long getItemId(int position) {
//        return position;
//    }

//    public int getItemViewType(int position) {
//        return position;
//    }

    public View getView(int position, View convertView, ViewGroup parent) {
        Log.v(TAG, "getView>>>>>>>");
        ChatMsgEntity entity = coll.get(position);
        
        return entity.viewItem;
    }

//    public int getViewTypeCount() {
//        return 1;
//    }

//    public boolean hasStableIds() {
//        return false;
//    }

//    public boolean isEmpty() {
//        return false;
//    }

//    public void registerDataSetObserver(DataSetObserver observer) {
//    }
//
//    public void unregisterDataSetObserver(DataSetObserver observer) {
//    }

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}
}

 

为了防止选中时出现黄色背景,设置listSelector值为#00000000

你可能感兴趣的:(肯定可以再TalkBack中设置 ListView焦点停在某个item上的方法)