本文整理汇总了Java中com.google.samples.apps.iosched.ui.widget.SlidingTabLayout.setCustomTabView方法的典型用法代码示例。如果您正苦于以下问题:Java SlidingTabLayout.setCustomTabView方法的具体用法?Java SlidingTabLayout.setCustomTabView怎么用?Java SlidingTabLayout.setCustomTabView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.samples.apps.iosched.ui.widget.SlidingTabLayout
的用法示例。
在下文中一共展示了SlidingTabLayout.setCustomTabView方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_viewpagertabfragment_parent, container, false);
AppCompatActivity parentActivity = (AppCompatActivity) getActivity();
mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
mPager = (ViewPager) view.findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
ViewConfiguration vc = ViewConfiguration.get(parentActivity);
mSlop = vc.getScaledTouchSlop();
mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
return view;
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:23,代码来源:ViewPagerTabFragmentParentFragment.java
示例2: onCreateView
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_view_pager_parent, container, false);
view.findViewById(R.id.container).setBackgroundColor(ThemeManager.getBackgroundColor(getContext()));
view.findViewById(R.id.pager).setBackgroundColor(ThemeManager.getBackgroundColor(getContext()));
view.findViewById(R.id.sliding_tabs).setBackgroundColor(ThemeManager.getPrimaryColor(getContext()));
PagerAdapter pagerAdapter = new NavigationAdapter(view.getContext(), getChildFragmentManager());
ViewPager viewPager = (ViewPager) view.findViewById(R.id.pager);
viewPager.setAdapter(pagerAdapter);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(ContextCompat.getColor(getActivity(), R.color.highlight));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(viewPager);
return view;
}
示例3: onCreateView
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_viewpagertabfragment_parent, container, false);
ActionBarActivity parentActivity = (ActionBarActivity) getActivity();
mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
mPager = (ViewPager) view.findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
ViewConfiguration vc = ViewConfiguration.get(parentActivity);
mSlop = vc.getScaledTouchSlop();
mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
return view;
}
开发者ID:brucetoo,项目名称:Android-ObservableScrollView,代码行数:23,代码来源:ViewPagerTabFragmentParentFragment.java
示例4: onCreate
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewpagertab2);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ViewCompat.setElevation(findViewById(R.id.header), getResources().getDimension(R.dimen.toolbar_elevation));
mToolbarView = findViewById(R.id.toolbar);
mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
// Padding for ViewPager must be set outside the ViewPager itself
// because with padding, EdgeEffect of ViewPager become strange.
final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
findViewById(R.id.pager_wrapper).setPadding(0, getActionBarSize() + tabHeight, 0, 0);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
ViewConfiguration vc = ViewConfiguration.get(this);
mSlop = vc.getScaledTouchSlop();
mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
}
示例5: onCreate
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flexiblespacewithimagewithviewpagertab);
mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
mFlexibleSpaceHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
mTabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
TextView titleView = (TextView) findViewById(R.id.title);
titleView.setText(R.string.title_activity_flexiblespacewithimagewithviewpagertab);
mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
mSlidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
mSlidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
mSlidingTabLayout.setDistributeEvenly(true);
mSlidingTabLayout.setViewPager(mPager);
// Initialize the first Fragment's state when layout is completed.
ScrollUtils.addOnGlobalLayoutListener(mSlidingTabLayout, new Runnable() {
@Override
public void run() {
translateTab(0, false);
}
});
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:29,代码来源:FlexibleSpaceWithImageWithViewPagerTabActivity.java
示例6: onCreate
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewpagertab2);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
mToolbarView = findViewById(R.id.toolbar);
mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
// Padding for ViewPager must be set outside the ViewPager itself
// because with padding, EdgeEffect of ViewPager become strange.
final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
findViewById(R.id.pager_wrapper).setPadding(0, getActionBarSize() + tabHeight, 0, 0);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
ViewConfiguration vc = ViewConfiguration.get(this);
mSlop = vc.getScaledTouchSlop();
mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
}
示例7: onCreate
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flexiblespacewithimagewithviewpagertab2);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ViewCompat.setElevation(findViewById(R.id.header), getResources().getDimension(R.dimen.toolbar_elevation));
mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
mImageView = findViewById(R.id.image);
mOverlayView = findViewById(R.id.overlay);
// Padding for ViewPager must be set outside the ViewPager itself
// because with padding, EdgeEffect of ViewPager become strange.
mFlexibleSpaceHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
mTabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
findViewById(R.id.pager_wrapper).setPadding(0, mFlexibleSpaceHeight, 0, 0);
mTitleView = (TextView) findViewById(R.id.title);
mTitleView.setText(getTitle());
setTitle(null);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
((FrameLayout.LayoutParams) slidingTabLayout.getLayoutParams()).topMargin = mFlexibleSpaceHeight - mTabHeight;
ViewConfiguration vc = ViewConfiguration.get(this);
mSlop = vc.getScaledTouchSlop();
mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
ScrollUtils.addOnGlobalLayoutListener(mInterceptionLayout, new Runnable() {
@Override
public void run() {
updateFlexibleSpace();
}
});
}
开发者ID:brucetoo,项目名称:Android-ObservableScrollView,代码行数:41,代码来源:FlexibleSpaceWithImageWithViewPagerTab2Activity.java
示例8: setupTabs
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
private void setupTabs(QuestCollection collection, QuestCollectionStatus collectionStatus) {
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
SlidingTabLayout slidingTabs = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
// Configure sliding tabs style
slidingTabs.setCustomTabView(R.layout.quiz_tab_element, R.id.text);
slidingTabs.setDistributeEvenly(false); // Keep same width for all tabs
// Set adapters
viewPager.setAdapter(new QuizFragmentPageAdapter(getSupportFragmentManager(), collection));
slidingTabs.setViewPager(viewPager);
slidingTabs.setCustomTabColorizer(new QuizStatusTabColorizer(collectionStatus));
}
示例9: onCreate
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flexiblespacewithimagewithviewpagertab2);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ViewCompat.setElevation(findViewById(R.id.header), getResources().getDimension(R.dimen.toolbar_elevation));
mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
mImageView = findViewById(R.id.image);
mOverlayView = findViewById(R.id.overlay);
// Padding for ViewPager must be set outside the ViewPager itself
// because with padding, EdgeEffect of ViewPager become strange.
mFlexibleSpaceHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
mTabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
findViewById(R.id.pager_wrapper).setPadding(0, mFlexibleSpaceHeight, 0, 0);
mTitleView = (TextView) findViewById(R.id.title);
mTitleView.setText(getTitle());
setTitle(null);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
((FrameLayout.LayoutParams) slidingTabLayout.getLayoutParams()).topMargin = mFlexibleSpaceHeight - mTabHeight;
ViewConfiguration vc = ViewConfiguration.get(this);
mSlop = vc.getScaledTouchSlop();
mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
mScroller = new OverScroller(getApplicationContext());
ScrollUtils.addOnGlobalLayoutListener(mInterceptionLayout, new Runnable() {
@Override
public void run() {
// Extra space is required to move mInterceptionLayout when it's scrolled.
// It's better to adjust its height when it's laid out
// than to adjust the height when scroll events (onMoveMotionEvent) occur
// because it causes lagging.
// See #87: https://github.com/ksoichiro/Android-ObservableScrollView/issues/87
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
lp.height = getScreenHeight() + mFlexibleSpaceHeight;
mInterceptionLayout.requestLayout();
updateFlexibleSpace();
}
});
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:52,代码来源:FlexibleSpaceWithImageWithViewPagerTab2Activity.java
示例10: onCreate
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_session_livestream);
mIsTablet = UIUtils.isTablet(this);
// Set up YouTube player
mYouTubeFragment = (YouTubePlayerFragment)
getFragmentManager().findFragmentById(R.id.livestream_player);
mYouTubeFragment.initialize(Config.YOUTUBE_API_KEY, this);
// Views that are common over all layouts
mMainLayout = (LinearLayout) findViewById(R.id.livestream_mainlayout);
adjustMainLayoutForActionBar();
mPlayerContainer = (LinearLayout) findViewById(R.id.livestream_player_container);
mFullscreenCaptions = (FrameLayout) findViewById(R.id.fullscreen_captions);
final LayoutParams params = (LayoutParams) mFullscreenCaptions.getLayoutParams();
params.setMargins(0, getActionBarHeightPx(), 0, getActionBarHeightPx());
mFullscreenCaptions.setLayoutParams(params);
mTabsContentLayout = (LinearLayout) findViewById(R.id.livestream_tabs_layout);
// Set up ViewPager and adapter
ViewPager viewPager = (ViewPager) findViewById(R.id.livestream_pager);
viewPager.setOffscreenPageLimit(2);
viewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.page_margin_width));
mTabsAdapter = new TabsAdapter(getFragmentManager());
viewPager.setAdapter(mTabsAdapter);
viewPager.setOnPageChangeListener(mTabsAdapter);
if (mIsTablet) {
// Tablet UI specific views
mVideoLayout = (LinearLayout) findViewById(R.id.livestream_video_layout);
}
mTabsAdapter.addTab(getString(R.string.session_livestream_info),
new SessionSummaryFragment(), TABNUM_SESSION_SUMMARY);
mTabsAdapter.addTab(getString(R.string.session_livestream_captions),
new SessionCaptionsFragment(), TABNUM_LIVE_CAPTIONS);
// Set up sliding tabs w/ViewPager
SlidingTabLayout slidingTabLayout =
(SlidingTabLayout) findViewById(R.id.livestream_sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
Resources res = getResources();
slidingTabLayout.setSelectedIndicatorColors(
res.getColor(R.color.tab_selected_strip));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(viewPager);
// Reload all other data in this activity
reloadFromIntent(getIntent());
// Update layout based on current configuration
updateLayout(getResources().getConfiguration());
// Set up action bar
if (!mLoadFromExtras) {
// Start sessions query to populate action bar navigation spinner
getLoaderManager().initLoader(SessionsQuery._TOKEN, null, this);
mLivestreamAdapter = new LivestreamAdapter(getActionBar().getThemedContext());
}
}