In My Application i have Implement the Simple Gallery Demo. Here i am going to set text Value according to user viewing the gallery.
The Code for GetViewmeth of Value Adaptationer category:
public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(this.myContext);
i.setImageResource(this.myImageIds[position]);
/* Image should be scaled as width/height are set. */
i.setScaleType(ImageView.ScaleType.FIT_XY);
/* Set the Width/Height of the ImageView. */
i.setLayoutParams(new Gallery.LayoutParams(300, 300));
switch(position){
case 0:
productName.setText("dimond540_1");
break;
case 1:
productName.setText("diamond540_2");
break;
case 2:
productName.setText("diamond_ink_bottle_1");
break;
case 3:
productName.setText("diamond_ink_bottle_2");
break;
case 4:
productName.setText("diamond_ink_bottle_3");
break;
case 5:
productName.setText("micarta_1");
break;
case 6:
productName.setText("micarta_2");
break;
case 7:
productName.setText("vac700_1");
break;
case 8:
productName.setText("vac700_2");
break;
}
return i;
}
/** Returns the size (0.0f to 1.0f) of the views
* depending on the offset to the center. */
public float getScale(boolean focused, int offset) {
/* Formula: 1 / (2 ^ offset) */
return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset)));
}
}
现在,虽然人们看着大概的形象,但文字价值正在改变。 但我无法得到案文。 (一) 作为第二位职位和第二位最后职位确定的价值。
我多次尝试,但每次都看一看一看一看一看,而不是第二位立场文本。
因此,我的法典有什么错误?