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


Java SlidingTabLayout类代码示例

本文整理汇总了Java中com.google.samples.apps.iosched.ui.widget.SlidingTabLayout的典型用法代码示例。如果您正苦于以下问题:Java SlidingTabLayout类的具体用法?Java SlidingTabLayout怎么用?Java SlidingTabLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SlidingTabLayout类属于com.google.samples.apps.iosched.ui.widget包,在下文中一共展示了SlidingTabLayout类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onActivityCreated

import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    tabNames = new CharSequence[]{getResources().getString(R.string.title_wifi_tab), getResources().getString(R.string.title_history_tab)};

    ViewPagerAdapter adapter = new ViewPagerAdapter(getActivity().getSupportFragmentManager(),tabNames);

    ViewPager pager = (ViewPager) getActivity().findViewById(R.id.tabs_viewpager);
    pager.setAdapter(adapter);

    SlidingTabLayout tabs = (SlidingTabLayout) getActivity().findViewById(R.id.tabs);
    tabs.setDistributeEvenly(true);
    tabs.setViewPager(pager);

    tabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer(){
        @Override
        public int getIndicatorColor(int position) {
            return getResources().getColor(R.color.accent);
        }

    });

}
 
开发者ID:Lois9Y,项目名称:WiFiEye,代码行数:24,代码来源:MainActivityFragment.java

示例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_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;
}
 
开发者ID:Ashish-Bansal,项目名称:OneTapVideoDownload,代码行数:19,代码来源:ViewPagerFragmentParent.java

示例4: 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

示例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_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);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:29,代码来源:ViewPagerTab2Activity.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_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

示例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_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);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:28,代码来源:ViewPagerTab2Activity.java

示例8: 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

示例9: 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));
}
 
开发者ID:fdi2-epsilon,项目名称:teams-game,代码行数:14,代码来源:QuizActivity.java

示例10: 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

示例11: 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());
    }
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:66,代码来源:SessionLivestreamActivity.java


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