我想获得它的位置,在Android中的一个类中使用它。
声明类方法
public class Adaptador extends BaseAdapter {
和方法
@Override
public View getView(*int position*, View convertirView, ViewGroup parent) {
final View view;
final ViewHolder holder;
if (null == convertirView) {
view = mLayoutInflater.inflate(mResourceId, parent, false);
holder = new ViewHolder();
assert view != null;
holder.image = (ImageView) view.findViewById(R.id.image);
holder.title = (TextView) view.findViewById(R.id.title);
view.setTag(holder);
} else {
view = convertirView;
holder = (ViewHolder) view.getTag();
}
bindView(holder, position);
return view;
}
我想得到这个方法的位置。
答案 0 :(得分:0)
viewpager.setOnPageChangedListener(new OnPageChangedListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
// position is your current position
}
@Override
public void onPageScrollStateChanged(int state) {
}
});