0
我真的實施ViewPagerIndicator喜歡這裏勸:http://blog.stylingandroid.com/archives/537的Android ViewPagerIndicator不`噸節目標籤
而且一切是正常的,只是我的inddicator不顯示標籤,我設置。 Here`s我如何設置他們:
公共類MainPagerActivity延伸活動{
private ViewPager pager;
private List<View> pages;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.viewpager_main);
initUI();
}
private void initUI() {
LayoutInflater inflater = LayoutInflater.from(this);
pager = (ViewPager)findViewById(R.id.main_pager);
pages = new ArrayList<View>();
pager.setCurrentItem(0);
ListView all = (ListView)inflater.inflate(R.layout.all_thoughts, null);
all.setTag("All thoughts");
pages.add(all);
ListView favorites = (ListView)inflater.inflate(R.layout.all_thoughts, null);
favorites.setTag(R.string.favorites);
pages.add(favorites);
RelativeLayout profile = (RelativeLayout)inflater.inflate(R.layout.profile, null);
profile.setTag(R.string.profile);
pages.add(profile);
ViewPagerAdapter adapter = new ViewPagerAdapter(pages);
pager.setAdapter(adapter);
TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.indicator);
titleIndicator.setViewPager(pager);
titleIndicator.setCurrentItem(0);
}
}