回答
PagerTitleStrip是你ViewPager
用什麼來表示你在哪一頁。這是你添加到你的XML
。
佈局XML:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<android.support.v4.view.PagerTitleStrip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top" />
</android.support.v4.view.ViewPager>
</LinearLayout>
而在你PagerAdapter:
@Override
public CharSequence getPageTitle (int position) {
return "Your static title";
}
然而,PagerTitleStrip
不是很定製的,但ViewPagerIndicator是非常定製,包括點狀的指標,您正在尋找。您需要將其主題重新創建OP中的圖片。
與ViewPagerIndicator
圓圈指示符:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.viewpagerindicator.sample"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicator"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
/>
</LinearLayout>
然後在你的代碼:
CirclePageIndicator mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
ViewPagerExtensions是另一個開源庫,提供自定義視圖爲ViewPager
你可能會感興趣。
謝謝,這可能正是我需要的。 – 2012-04-04 09:57:23
我無法完成工作,JakeWarton上的項目似乎並不容易配置。你有任何其他文件可以幫助嗎? – 2012-04-05 17:53:45
這非常容易,我相信你會得到它的工作。以下是[ViewPagerIndicator網站](http://viewpagerindicator.com/#usage)的鏈接,以及指向[一系列定製化文章的鏈接]的鏈接。(http://blog.stylingandroid.com/archives/537) – adneal 2012-04-05 18:34:15
- 1. Android主屏幕計數
- 2. 在JavaFX上製作主頁面(屏幕)
- 3. 更改Android主屏幕頁面編程
- 4. 在Android上實現分層屏幕
- 5. 在iPad上從主屏幕運行時無法呈現頁面
- 6. Android:實現錯誤屏幕
- 7. 主屏幕上的Android書籤不刷新頁面
- 8. Android啓動器主屏幕
- 9. 主屏幕發射器Android
- 10. Android主屏幕發射器
- 11. 在Android 2.0中實現屏幕鎖定
- 12. 如何在主屏幕和子屏幕上添加頁碼
- 13. 在Android上獲取主屏幕位置
- 14. 在android上實現頁面捲曲?
- 15. XNA主頁屏幕
- 16. 如何實現材料主屏幕
- 17. 實現「添加到主屏幕」,ala Safari
- 18. 在主屏幕上顯示加載屏幕小部件Android
- 19. 計時器出現在遊戲屏幕
- 20. Android應用程序主屏幕設計
- 21. 的Android UI的主屏幕設計
- 22. 試圖在屏幕上實現遊戲
- 23. 如何實現音樂在屏幕上
- 24. 的Android:主屏幕
- 25. Android主屏幕自動滾動槽頁
- 26. 如何在我的Android應用程序中實現主屏幕啓動器?
- 27. Sharepoint主頁面實現
- 28. 計時器在主屏幕上運行iPhone - Objective C
- 29. 屏幕抓取完全呈現頁面
- 30. ApplicationBar在主屏幕上?
你使用'V iewPager'還是什麼? – adneal 2012-04-04 09:21:55
是的。我基本上遵循這個例子http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.html – 2012-04-04 09:43:53