複数のイメージビューを動的に配置するギャラリービューを使用しましたが、イメージビューをクリックすると中央に表示され、画面の左側から最初のイメージビューを開始する方法が2番目の質問になります。
ユーザーが指で水平方向にスクロールするまで、場所を変更したくありません。これを達成する方法はありますか。これを助けてください..
private class ImageAdapter extends BaseAdapter{
public ImageAdapter() {
//To set blank at bottom and make visible
TextView textView = (TextView)findViewById(R.id.textView2);
textView.setVisibility(View.VISIBLE);
//To set the visibility visible of gallery
myGallery.setVisibility(View.VISIBLE);
}
public int getCount() {
return ProductItemArray.Image_URL.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
public View getView(int position, View arg1, ViewGroup arg2) {
ImageView bottomImageView = new ImageView(context);
if(Helper.isTablet(context))
bottomImageView.setLayoutParams(new Gallery.LayoutParams(VirtualMirrorActivity.convertDpToPixel(100, context), VirtualMirrorActivity.convertDpToPixel(100, context)));
else
bottomImageView.setLayoutParams(new Gallery.LayoutParams(VirtualMirrorActivity.convertDpToPixel(80, context), VirtualMirrorActivity.convertDpToPixel(80, context)));
UrlImageViewHelper.setUrlDrawable(bottomImageView, ProductItemArray.Image_URL[position]);
bottomImageView.setBackgroundResource(R.layout.border);
return bottomImageView;
}
}
myGallery.setAdapter(new ImageAdapter());
myGallery.setSelection(1);
myGallery.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long arg3)
{
linearLayout.removeView(frameImageView);
Thread newThread = new Thread(new Runnable() {
public void run() {
URL url_1 = null;
try {
isAlreadyExistInWishlist = false;
VMProductListPaging.productUrl = ProductItemArray.Image_small_URL[position];
VMProductListPaging.productId = ProductItemArray.productId[position];
VMProductListPaging.productName = ProductItemArray.product_Name[position];
url_1 = new URL(ProductItemArray.Image_small_URL[position]);
bmp = BitmapFactory.decodeStream(url_1.openConnection().getInputStream());
isExecuted = true;
bitmapHandler.sendMessage(bitmapHandler.obtainMessage());
}
catch (Exception e) {
//Toast.makeText(context,"Sorry!! This link appears to be broken",Toast.LENGTH_LONG).show();
}
}
});
newThread.start();
}
});
レイアウト.xml
<Gallery android:id="@+id/galleryView" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:spacing="5dp" android:layout_below="@+id/sendPhoto" android:layout_marginTop="10dp" android:visibility="gone"/> `enter code here`