【发布时间】:2011-10-30 01:00:04
【问题描述】:
朋友。 我正在尝试为我的应用程序制作 ViewPager。我已经制作了寻呼机功能来显示页面和滑动来更改页面。 但是,在我的 Main Activity (NUM_PAGES = 3) 上,我想将我的每个 Class : Class One, Two, and Three 设置为 pageView,这可能吗?
这是我的来源:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
scroller = ((Pager)findViewById(R.id.scrollView));
indicator = ((PageIndicator)findViewById(R.id.indicator));
indicator.setPager(scroller);
LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (int i = 0; i < NUM_PAGES; i++) {
.....
what should i do here?
.....
scroller.addPage(pageView);
}
所以,如果我将它滑到右侧,它将变为 Class“Two”(第 2 页),如果我再次将其滑到右侧,它将切换到 Class“Three”(第 3 页)。
请帮帮我,在此先感谢 :-)
【问题讨论】:
标签: android class pager android-viewpager