第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

ViewPager放在Fragment中怎么實(shí)現(xiàn)

我把ViewPager放在Fragment中的,但是程序運(yùn)行后,滑到最后一頁(yè)的時(shí)候,程序就異常退出了?怎么回事

public?class?FirstFragment?extends?Fragment{

????private?ViewPager?mViewPager;
????private?int[]?mImagIds?=?new?int[]{R.mipmap.viewpager_1,R.mipmap.viewpager_2,R.mipmap.viewpager_3};
????private?List<View>?mImages?=?new?ArrayList<View>();


????public?View?onCreateView(LayoutInflater?inflater,?ViewGroup?container,Bundle?savedInstanceState){
????????View?view?=?inflater.inflate(R.layout.first_fragment,container,false);

????????mViewPager?=?(ViewPager)?view.findViewById(R.id.viewpager);

????????mViewPager.setAdapter(new?PagerAdapter()?{
????????????@Override
????????????public?Object?instantiateItem(ViewGroup?container,?int?position)?{
????????????????ImageView?imageview?=?new?ImageView(getActivity());
????????????????imageview.setImageResource(mImagIds[position]);
????????????????imageview.setScaleType(ImageView.ScaleType.CENTER_CROP);
????????????????container.addView(imageview);
????????????????return?imageview;
????????????}

????????????@Override
????????????public?void?destroyItem(ViewGroup?container,?int?position,?Object?object)?{
????????????????container.removeView(mImages.get(position));
????????????}

????????????@Override
????????????public?int?getCount()?{
????????????????return?mImagIds.length;
????????????}

????????????@Override
????????????public?boolean?isViewFromObject(View?view,?Object?object)?{
????????????????return?view?==?object;
????????????}
????????});

????????return?view;
????}


正在回答

1 回答

沒(méi)有把imageview放到mImages中

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
千變?nèi)f化的ViewPager切換動(dòng)畫
  • 參與學(xué)習(xí)       44479    人
  • 解答問(wèn)題       91    個(gè)

ViewPager界面切換是可以有動(dòng)畫,課程涉及到屬性動(dòng)畫等知識(shí)點(diǎn)

進(jìn)入課程

ViewPager放在Fragment中怎么實(shí)現(xiàn)

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)