如何将活动转换为片段

时间:2014-05-16 01:23:24

标签: android

如何将此转换为Fragment以使用ViewPager

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    final ViewHolder holder;
    View view = convertView;

    if (view == null) {

       view = getLayoutInflater().inflate(R.layout.item_grid_image, parent,    false);
       holder = new ViewHolder();
       assert view != null;
       holder.imageView = (ImageView) view.findViewById(R.id.image);
       holder.progressBar = (ProgressBar)view.findViewById(R.id.progress);
       view.setTag(holder);
           // ......
    }

}

1 个答案:

答案 0 :(得分:0)

以下是实施ViewPager ViewPager Tutotial&的示例。 ViewPager with FragmentPageAdapter