朋友。 我正在嘗試使ViewPager成爲我的應用程序。我已經使傳呼機功能顯示頁面和幻燈片來更改頁面。 但是,在我的主要活動(NUM_PAGES = 3)上,我想將我的每個Class:Class 1,Two和Three設置爲pageView,這可能嗎?使用Viewpager上的Class更改頁面
這裏是我的源:
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);
}
所以,如果我把它滑動到右側,它會變成類「兩」(第2頁),如果我便又將其滑動時,它會打到Class「Three」(第3頁)。
請幫助我,在此先感謝:-)
你能舉個例子嗎,先生?謝謝 – wdyz
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html – HaMMeReD
不,我的意思是,我發現它時Google搜索它。但是,它只是用於查看而不是激活:( – wdyz