当前位置: 首页>>代码示例>>Java>>正文


Java PagerAdapter.getPageTitle方法代码示例

本文整理汇总了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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:TabPageIndicator.java

示例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();
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:26,代码来源:TabPageIndicator.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:26,代码来源:TabPageIndicator.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:StepperIndicator.java

示例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();
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:29,代码来源:UnderLinePageIndicator.java


注:本文中的android.support.v4.view.PagerAdapter.getPageTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。