您可以将与每个图像相对应的字符串数组传递到适配器中。
在活动中,声明带有图像列表的字符串数组。
private int imageArra[] = { R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d, R.drawable.e};private String[] stringArray = new String[] { "Image a", "Image b","Image c","Image d","Image e"};然后在实例化适配器时。
ImagePagerAdapter adapter = new ImagePagerAdapter(this, imageArra, stringArray );
在您的适配器中:
int imageArray[];String[] stringArray;public ImagePagerAdapter(Activity act, int[] imgArra, String[] stringArra) { imageArray = imgArra; activity = act; stringArray = stringArra;}然后从数组中分配文本值
TextView txt=(TextView) layout.findViewById(R.id.image_text);txt.setText(stringArray[position]);



