2015年1月14日 星期三

Android update ViewPager View


@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = null;
    view = mInflater.inflate(R.layout.record_list_layout, null);          
    TextView test= (TextView) view.findViewById(R.id.test);
    String key = "test" + position;

    test.setTag(key);
  ((ViewPager) arg0).addView(view );
    return view;
}

//0為第一筆
TextView test= myViewPager.findViewWithTag("test0");
// 更新內容
if (test!= null ) {
    test.setText("update");
}

沒有留言:

張貼留言