本文整理汇总了Java中android.support.v4.view.PagerAdapter.getPageTitle方法的典型用法代码示例。如果您正苦于以下问题:Java PagerAdapter.getPageTitle方法的具体用法?Java PagerAdapter.getPageTitle怎么用?Java PagerAdapter.getPageTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.PagerAdapter
的用法示例。
在下文中一共展示了PagerAdapter.getPageTitle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyDataSetChanged
import android.support.v4.view.PagerAdapter; //导入方法依赖的package包/类
public void notifyDataSetChanged() {
mTabLayout.removeAllViews();
PagerAdapter adapter = mViewPager.getAdapter();
IconPagerAdapter iconAdapter = null;
if (adapter instanceof IconPagerAdapter) {
iconAdapter = (IconPagerAdapter)adapter;
}
final int count = adapter.getCount();
for (int i = 0; i < count; i++) {
CharSequence title = adapter.getPageTitle(i);
if (title == null) {
title = EMPTY_TITLE;
}
int iconResId = 0;
if (iconAdapter != null) {
iconResId = iconAdapter.getIconResId(i);
}
addTab(i, title, iconResId);
}
if (mSelectedTabIndex > count) {
mSelectedTabIndex = count - 1;
}
setCurrentItem(mSelectedTabIndex);
requestLayout();
}
示例2: notifyDataSetChanged
import android.support.v4.view.PagerAdapter; //导入方法依赖的package包/类
public void notifyDataSetChanged() {
mTabLayout.removeAllViews();
PagerAdapter adapter = mViewPager.getAdapter();
IconPagerAdapter iconAdapter = null;
if (adapter instanceof IconPagerAdapter) {
iconAdapter = (IconPagerAdapter) adapter;
}
final int count = adapter.getCount();
for (int i = 0; i < count; i++) {
CharSequence title = adapter.getPageTitle(i);
if (title == null) {
title = EMPTY_TITLE;
}
int iconResId = 0;
if (iconAdapter != null) {
iconResId = iconAdapter.getIconResId(i);
}
addTab(i, title, iconResId);
}
if (mSelectedTabIndex > count) {
mSelectedTabIndex = count - 1;
}
setCurrentItem(mSelectedTabIndex);
requestLayout();
}
示例3: notifyDataSetChanged
import android.support.v4.view.PagerAdapter; //导入方法依赖的package包/类
public void notifyDataSetChanged() {
this.mTabLayout.removeAllViews();
PagerAdapter adapter = this.mViewPager.getAdapter();
IconPagerAdapter iconAdapter = null;
if (adapter instanceof IconPagerAdapter) {
iconAdapter = (IconPagerAdapter) adapter;
}
int count = adapter.getCount();
for (int i = 0; i < count; i++) {
CharSequence title = adapter.getPageTitle(i);
if (title == null) {
title = EMPTY_TITLE;
}
int iconResId = 0;
if (iconAdapter != null) {
iconResId = iconAdapter.getIconResId(i);
}
addTab(i, title, iconResId);
}
if (this.mSelectedTabIndex > count) {
this.mSelectedTabIndex = count - 1;
}
setCurrentItem(this.mSelectedTabIndex);
requestLayout();
}
示例4: setLabelsUsingPageTitles
import android.support.v4.view.PagerAdapter; //导入方法依赖的package包/类
private void setLabelsUsingPageTitles() {
PagerAdapter pagerAdapter = pager.getAdapter();
int pagerCount = pagerAdapter.getCount();
labels = new CharSequence[pagerCount];
for(int i = 0; i < pagerCount; i++)
labels[i] = pagerAdapter.getPageTitle(i);
}
示例5: notifyDataSetChanged
import android.support.v4.view.PagerAdapter; //导入方法依赖的package包/类
public void notifyDataSetChanged() {
Logger.d("notify data set change");
mTabLayout.removeAllViews();
PagerAdapter adapter = mViewPager.getAdapter();
IconPagerAdapter iconAdapter = null;
if (adapter instanceof IconPagerAdapter) {
iconAdapter = (IconPagerAdapter) adapter;
}
final int count = adapter.getCount();
for (int i = 0; i < count; i++) {
CharSequence title = adapter.getPageTitle(i);
if (title == null) {
title = EMPTY_TITLE;
}
int iconResId = 0;
boolean useStroke = false;
if (iconAdapter != null) {
iconResId = iconAdapter.getIconResId(i);
useStroke = iconAdapter.useStroke(i);
}
addTab(i, title, iconResId, useStroke);
}
if (mSelectedTabIndex > count) {
mSelectedTabIndex = count - 1;
}
setCurrentItem(mSelectedTabIndex);
requestLayout();
}