任何人都可以告訴我爲什麼我得到位置onSwipeRight()方法嗎?在ArrayApdapter getView()返回錯誤的位置
@Override
public View getView(final int position, View view, ViewGroup parent) {
View v = view;
if(v==null){
LayoutInflater inflater = context.getLayoutInflater();
v = inflater.inflate(R.layout.listviewlayout, null);
holder=new ViewHolder();
holder. txtTitle = (TextView) v.findViewById(R.id.label);
holder. date = (TextView) v.findViewById(R.id.textView1);
holder. time = (TextView) v.findViewById(R.id.textView2);
holder. b=(Button) v.findViewById(R.id.button1);
v.setTag(holder);
Constants.list.setOnTouchListener(new OnSwipeTouchListener() {
public void onSwipeTop() {
// Toast.makeText(SavedList.this, "top", Toast.LENGTH_SHORT).show();
}
public void onSwipeRight() {
// Toast.makeText(SavedList.this, "right", Toast.LENGTH_SHORT).show();
holder.b.setVisibility(View.VISIBLE);
int a=position;
Log.e("ds",String.valueOf(a));
}
public void onSwipeLeft() {
//Toast.makeText(SavedList.this, "left", Toast.LENGTH_SHORT).show();
}
public void onSwipeBottom() {
//Toast.makeText(SavedList.this, "bottom", Toast.LENGTH_SHORT).show();
}
});
是List ListView嗎? – 2014-08-29 07:57:51
是這是一個列表視圖 – Soham 2014-08-29 07:59:13
發佈你的'listviewlayout' xml – 2014-08-29 08:01:53