Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>Create Image View at run time and add to Gallery.Your Activity Should implements ViewFactory private class ImageAdapter extends BaseAdapter{ Context mContext; private int itemBackground; //private LayoutInflater layoutInflater; public ImageAdapter(Context c){ mContext = c; //tempBitmap.clear(); //tempBitmap=hashMap.get("page"+pageCount); tempbitmap=new ArrayList&lt;Bitmap&gt;(); tempbitmap.clear(); int end=pageCount*5; int start=end-5; tempbitmap=bitmapArray.subList(start, end); TypedArray attr = obtainStyledAttributes(R.styleable.HelloGallery); itemBackground = attr.getResourceId( R.styleable.HelloGallery_android_galleryItemBackground, 0); attr.recycle(); //layoutInflater = LayoutInflater.from(c); } @Override public int getCount() { // TODO Auto-generated method stub return tempbitmap.size(); } @Override public View getView(int position, View convertView, ViewGroup arg2) { // TODO Auto-generated method stub ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new Gallery.LayoutParams(170,grid_main.getHeight())); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setBackgroundResource(itemBackground); //imageView.setPadding(8,8,8,8); } else { imageView = (ImageView) convertView; } imageView.setImageBitmap(tempbitmap.get(position)); return imageView; } @Override public Object getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } } @Override public View makeView() { // TODO Auto-generated method stub ImageView imageView = new ImageView(this); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); imageView.setLayoutParams(new ImageSwitcher.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); imageView.setBackgroundColor(0xFF000000); return imageView; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload