目前我正在使用画廊视图并使用它的滑动效果,使用基本适配器可以很好地工作。但是我已经更改了场景我想在单击按钮左侧和单击按钮右侧更改图库视图中的图像,并希望使用基本适配器的基本适配器代码禁用图库 im 的滑动视图,如下所示
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;
}
}
我的按钮运动如下
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;
}
}
现在我需要禁用图库滑动需要帮助谢谢