같은 데이터셋을 두개를 넣어 리스트의 데이터를 만든 후
OnItemSelectedListener 에서 앞부분 또는 뒷부분의 일정 위치가 되면 selection의 위치를 변경해준다.
OnItemSelectedListener 에서 앞부분 또는 뒷부분의 일정 위치가 되면 selection의 위치를 변경해준다.
OnItemSelectedListener selectedListener = new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (selectedItemInfoView != null) {
ProductItem item = (ProductItem) view.getTag();
TextView title = (TextView) selectedItemInfoView.findViewById(R.id.tv_SelectedInfoTitle);
TextView price = (TextView) selectedItemInfoView.findViewById(R.id.tv_SelectedInfoPrice);
TextView salePrice = (TextView)
selectedItemInfoView.findViewById(R.id.tv_SelectedInfoSalePrice);
title.setText("[ "+item.brandName+" ]"+item.title);
price.setText(item.price);
price.setPaintFlags(price.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
salePrice.setText(item.finalPrice);
SaleListAdapter adapter = (SaleListAdapter) parent.getAdapter();
if (position == 3) {
int itemSize = adapter.getCount();
parent.setSelection(position+itemSize/2);
} else if (position == adapter.getCount()-3) {
int itemSize = adapter.getCount();
parent.setSelection(position-itemSize/2);
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
};