i m 试图在电网格中提供立体值图像。 bt i 胎盘。
这是我的价值观/指示。
<integer-array name="anim">
<item >@drawable/goat1</item>
<item >@drawable/lamb1</item>
<item>@drawable/bear</item>
<item>@drawable/lion</item>
</integer-array>
这是我的 j。
公众人物
**int[] anim=getResources().getIntArray(R.array.anim);**
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));
iii
iii
public class ImageAdapter extends BaseAdapter { private Context mContext;
public ImageAdapter(Context c) {
mContext = c;
iii
public int getCount() {
return mThumbIds.length;
iii
public Object getItem(int position) {
return null;
iii
public long getItemId(int position) {
return 0;
iii
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) {
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(8, 8, 8, 8);
iii else {
imageView = (ImageView) convertView;
iii
imageView.setImageResource(anim[position]);
return imageView;
iii