android studio
不管是在Fragment 中加入背景图,还是在主FragmentActivity中加入背景图,都会影响到页面切换,去掉背景图后切换速度飞快…求指点
//以下是部分原码
private ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
private PagerAdapter mAdapter;
private ViewPager mViewPager;
private void initView(){
mViewPager = (ViewPager)findViewById(R.id.vp_mainview);
mFragments.add(fragment1.getInstance());
mFragments.add(fragment2.getInstance());
mAdapter = new PagerAdapter(getSupportFragmentManager());
mViewPager.setAdapter(mAdapter);
}
//PagerAdapter 没有作特殊处理,
private class PagerAdapter extends FragmentPagerAdapter {
public PagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return mFragments.size();
}
@Override
public Fragment getItem(int position) {
return mFragments.get(position);
}
}
不管是在Fragment 中加入背景图,还是在主FragmentActivity中加入背景图,都会影响到页面切换,去掉背景图后切换速度飞快…求指点
//以下是部分原码
private ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
private PagerAdapter mAdapter;
private ViewPager mViewPager;
private void initView(){
mViewPager = (ViewPager)findViewById(R.id.vp_mainview);
mFragments.add(fragment1.getInstance());
mFragments.add(fragment2.getInstance());
mAdapter = new PagerAdapter(getSupportFragmentManager());
mViewPager.setAdapter(mAdapter);
}
//PagerAdapter 没有作特殊处理,
private class PagerAdapter extends FragmentPagerAdapter {
public PagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return mFragments.size();
}
@Override
public Fragment getItem(int position) {
return mFragments.get(position);
}
}
解决方案
50
可能是你图片太大,然后放置的文件夹不对,大图片显示肯定不要background的,ImageView,src吧