본문 바로가기
프로그래밍/Android

ListView의 ListItem Touch 막기

by CaffeLatte 2013. 5. 22.

ListView를 사용시,

public class ListAdapter extends BaseAdapter {
    private LayoutInflater mInflater;

    public ListAdapter(Context context) {
        mInflater = LayoutInflater.from(context);
    }

... (중략)

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    int resource = R.layout.list_item;
    convertView = (LinearLayout) mInflater.inflate(resource, null);
    convertView.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true; // true를 반환하면 터치 안됨.
        }
    });
}

}

'프로그래밍 > Android' 카테고리의 다른 글

ImageView 여백 없애기  (0) 2013.06.08
SQLite select, insert, update, delete  (0) 2013.05.23
getBaseContext()와 getApplicationContext()의 차이  (0) 2013.05.14
Cursor의 메서드 목록  (0) 2013.04.22
URI, String 변환  (0) 2013.04.21

댓글