1
對不起,如果這確實是一個簡單的問題,但我是新來的。我正在使用ViewPager和我的應用程序的片段,通常按以下動畫所示輕掃頁面: http://developer.android.com/training/animation/screen-slide.html自定義ViewPager水平滑動主題/ Syle
但是我想要一些更像是書中或類似的東西。我搜查了很多,但沒有找到有用的東西。對於簡單的刷卡,我有以下
public class ManmohanSingh extends FragmentActivity {
SectionsPagerAdapter mSectionsPagerAdapter;
static ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.manmohan_singh);
mSectionsPagerAdapter = new SectionsPagerAdapter(
getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
}
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
public Fragment getItem(int position) {
Fragment manmohanAng = new ManmohanAng(position);
return manmohanAng;
}
@Override
public int getCount() {
return 1431;
}
@Override
public CharSequence getPageTitle(int position) {
Locale l = Locale.getDefault();
for (int i = 1; i <= 1431; i++) {
if (position == i) {
return "Ang " + position;
}
}
return null;
}
}
太棒了!非常感謝你的幫助。 :) – MrSingh