1
https://github.com/chrisbanes/PhotoViewHackyView尋呼機沒有顯示
我使用這個庫,以顯示viewpager一些照片(HackyViewPager)
它工作正常顯示圖片
但是當我想正確的位置顯示正確的照片的名稱顯示它顯示錯誤的位置名稱...
我想知道這個錯誤
mViewPager.setAdapter(new SamplePagerAdapter());
public class SamplePagerAdapter extends PagerAdapter {
final String[][] sDrawables = {{"Chrysanthemum.jpg","0"},{"Desert.jpg","1"},{"Hydrangeas.jpg","2"},{"Jellyfish.jpg","3"}, {"Koala.jpg","4"},{"Lighthouse.jpg","5"},{"Penguins.jpg","6"},{"Tulips.jpg","7"} };
@Override
public int getCount() {
return sDrawables.length;
}
@Override
public View instantiateItem(ViewGroup container,int position) {
PhotoView photoView = new PhotoView(container.getContext());
Log.i("xxx position ",position + " " + sDrawables[position][1]);
tvImageName.setText(sDrawables[position][1]);
Picasso.with(ViewPagerActivity.this)
.load("http://myserver/uploads/" + sDrawables[position][0])
.placeholder(R.drawable.placeholder)
.error(R.drawable.error)
.into(photoView);
container.addView(photoView, LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
return photoView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
}
你能幫我找到爲什麼這個工作是這樣嗎?