我用以下代码创建了GelleryView。我的问题是, 我不想显示图像选择,因为当我触摸滚动它时发光黄色。 如何禁用此单击或触摸,以便不显示黄色选定状态。
public class main extends Activity {
/** Called when the activity is first created. */
public Context context=main.this;
public Map< Integer,Drawable> dayMap;
ProgressDialog dialog;
Context con=main.this;
JSONArray json_array;
public static ArrayList<String> image;
public static ArrayList<Bitmap> imageBitmap;
mygallery gallery;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new DownloadMoreImages().execute();
gallery = (mygallery) findViewById(R.id.thisgallery);
}
public class AddImgAdp extends BaseAdapter {
int GalItemBg;
private Context cont;
public AddImgAdp(Context c) {
cont = c;
TypedArray typArray = obtainStyledAttributes(R.styleable.Gallery1);
GalItemBg = typArray.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 1);
typArray.recycle();
}
public int getCount() {
return dayMap.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imgView = new ImageView(cont);
imgView.setImageDrawable(dayMap.get(position));
imgView.setScaleType(ImageView.ScaleType.FIT_CENTER);
imgView.setBackgroundResource(GalItemBg);
imgView.setLayoutParams(new mygallery.LayoutParams(340 , 265));
return imgView;
}
}
public class mygallery extends Gallery {
public mygallery(Context ctx, AttributeSet attrSet) {
super(ctx, attrSet);
// TODO Auto-generated constructor stub
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY){
return false;
}
}
答案 0 :(得分:0)
尝试galleryview.setOnItemclickListener(null);