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


Java TabLayout.post方法代码示例

本文整理汇总了Java中android.support.design.widget.TabLayout.post方法的典型用法代码示例。如果您正苦于以下问题:Java TabLayout.post方法的具体用法?Java TabLayout.post怎么用?Java TabLayout.post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.design.widget.TabLayout的用法示例。


在下文中一共展示了TabLayout.post方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_notebook_tabs, container, false);

    mViewPagerAdapter = new MyViewPagerAdapter(getActivity());

    ViewPager viewPager = (ViewPager) view.findViewById(R.id.pager);
    viewPager.setAdapter(mViewPagerAdapter);

    mTabs = (TabLayout) view.findViewById(R.id.tabs);
    mTabs.post(new Runnable() {
        @Override
        public void run() {
            mTabs.setTabsFromPagerAdapter(mViewPagerAdapter);
        }
    });

    viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabs));
    mTabs.setOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));

    return view;
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:24,代码来源:NotebookTabsFragment.java

示例2: onCreateView

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    /**
     *Inflate tab_layout and setup Views.
     */
    View x =  inflater.inflate(R.layout.layout_tab, null);
    tabLayout = (TabLayout) x.findViewById(R.id.tabs);
    viewPager = (ViewPager) x.findViewById(R.id.viewpager);

    /**
     *Set an Apater for the View Pager
     */
    viewPager.setAdapter(new MyAdapter(getChildFragmentManager()));

    /**
     * Now , this is a workaround ,
     * The setupWithViewPager dose't works without the runnable .
     * Maybe a Support Library Bug .
     */

    tabLayout.post(new Runnable() {
        @Override
        public void run() {
            tabLayout.setupWithViewPager(viewPager);
        }
    });

    return x;

}
 
开发者ID:setakarim,项目名称:ingetin,代码行数:32,代码来源:TabFragment.java

示例3: onCreate

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_matching);
    dbHelper = DBHelper.getInstance();

    final TabLayout tabLayout = findViewById(R.id.matching_tabs);
    likeButton = findViewById(R.id.fab_match);
    dislikeButton = findViewById(R.id.fab_unmatch);
    imgView = findViewById(R.id.imageView2);
    imgView.setVisibility(View.GONE);

    viewPager = findViewById(R.id.matching_viewpager);
    viewPager.setVisibility(View.GONE);
    likeAndDislikeLayout =  findViewById(R.id.likeAndDislikeLayout);
    likeAndDislikeLayout.setVisibility(View.GONE);
    spinner = findViewById(R.id.progressBar);
    spinner.setVisibility(View.VISIBLE);

    adapter = new MatchFragmentPagerAdapter(getSupportFragmentManager());

    // Add fragments to the view pager
    datingPage = MatchPageFragment.newInstance(matchedDateList, true);
    friendPage = MatchPageFragment.newInstance(matchedFriendList, false);
    adapter.addFragment(datingPage, tabTitles[0]);
    adapter.addFragment(friendPage, tabTitles[1]);
    viewPager.setAdapter(adapter);

    // Change behavior of like and dislike buttons based on currently selected tab
    addPageChangeListener();

    tabLayout.post(new Runnable() {
        @Override
        public void run() {
            tabLayout.setupWithViewPager(viewPager);
        }
    });

    // Fetch list of potential friends from Firebase
    fetchPotentFriendsFromFirebase();

    // Fetch list of potential dates from Firebase
    fetchPotentDatesFromFirebase();

    // places toolbar on top of the screen
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.WHITE);
    setSupportActionBar(toolbar);

    // set up the side navigation bar on the left side of screen
    mDrawer = (DrawerLayout) findViewById(R.id.match_drawer_layout);
    navView = (NavigationView) findViewById(R.id.match_nav_view);
    setSideBarDrawer( mDrawer, navView, toolbar , dbHelper);
}
 
开发者ID:chrisqz95,项目名称:couch-potatoes,代码行数:55,代码来源:MatchingActivity.java


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