| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
package com.android.bidi; |
| 17 |
|
| 18 |
import android.content.Context; |
| 19 |
import android.view.View; |
| 20 |
import android.view.ViewGroup; |
| 21 |
import android.widget.BaseAdapter; |
| 22 |
import android.widget.ImageView; |
| 23 |
import android.widget.ImageView.ScaleType; |
| 24 |
|
| 25 |
public class BiDiTestGalleryImages extends BaseAdapter { |
| 26 |
int mGalleryItemBackground; |
| 27 |
private Context mContext; |
| 28 |
|
| 29 |
private Integer[] mImageIds = { |
| 30 |
R.drawable.alphabet_a, |
| 31 |
R.drawable.alphabet_b, |
| 32 |
R.drawable.alphabet_c, |
| 33 |
R.drawable.alphabet_d, |
| 34 |
R.drawable.alphabet_e, |
| 35 |
R.drawable.alphabet_f, |
| 36 |
R.drawable.alphabet_g, |
| 37 |
R.drawable.alphabet_h, |
| 38 |
R.drawable.alphabet_i, |
| 39 |
R.drawable.alphabet_j, |
| 40 |
}; |
| 41 |
|
| 42 |
public BiDiTestGalleryImages(Context c) { |
| 43 |
mContext = c; |
| 44 |
} |
| 45 |
|
| 46 |
@Override |
| 47 |
public int getCount() { |
| 48 |
return mImageIds.length; |
| 49 |
} |
| 50 |
|
| 51 |
@Override |
| 52 |
public Object getItem(int position) { |
| 53 |
return position; |
| 54 |
} |
| 55 |
|
| 56 |
@Override |
| 57 |
public long getItemId(int position) { |
| 58 |
return position; |
| 59 |
} |
| 60 |
|
| 61 |
@Override |
| 62 |
public View getView(int position, View convertView, ViewGroup parent) { |
| 63 |
ImageView i = new ImageView(mContext); |
| 64 |
i.setImageResource(mImageIds[position]); |
| 65 |
i.setScaleType(ScaleType.CENTER_INSIDE); |
| 66 |
return i; |
| 67 |
} |
| 68 |
} |