Reputation: 7023
Currently I am using gallery View and using its Swipe effect that is working perfectly fine Using base Adapter. But i have changed Scenario i want to change image in gallery View on click button left and click button right and want to disable the Swipe view of Gallery i m using base adapter code for base Adapter is as following
public class ImageAdapter extends BaseAdapter {
private Context ctx;
int imageBackground;
public ImageAdapter(Context c) {
ctx = c;
//TypedArray ta = obtainStyledAttributes(R.styleable.Gallery1);
//imageBackground = ta.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 1);
//ta.recycle();
}
@Override
public int getCount() {
return pics.length;
}
@Override
public Object getItem(int arg0) {
return arg0;
}
@Override
public long getItemId(int arg0) {
return arg0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
galaryBg= new ImageView(ctx);
galaryBg.setImageResource(pics[arg0]);
galaryBg.setScaleType(ImageView.ScaleType.FIT_CENTER);
galaryBg.setLayoutParams(new Gallery.LayoutParams(150,150));
//galaryBg.setBackgroundResource(imageBackground);
return galaryBg;
}
}
and my Button Movement are following
public void moveScreen(View v)
{
switch (v.getId()){
case R.id.dummy_leftnavBtn:
int position = mGallery.getSelectedItemPosition() - 1;
if (position < 0)
return;
checkIfonStart(position);
checkIfonEnd(position);
getStringWithPositon(position);
mGallery.setSelection(position);
break;
case R.id.dummy_rightnavBtn:
position = mGallery.getSelectedItemPosition() + 1;
if (position >= mGallery.getCount())
return;
checkIfonEnd(position);
checkIfonStart(position);
getStringWithPositon(position);
mGallery.setSelection(position);
break;
}
}
now i need to disable the Gallery Swipe need help thank you
Upvotes: 0
Views: 263
Reputation: 7023
I got the Solution
for this I just override the onTouchListener
and return always true
and that worked for me
Upvotes: 0