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


Java TabLayout.Tab方法代码示例

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


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

示例1: setupViewPager

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
public void setupViewPager () {
    CustomViewPager viewPager = (CustomViewPager) findViewById(R.id.view_pager);
    MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());

    if (viewPager != null) {
        viewPager.setPagingEnabled(false);
        viewPager.setAdapter(pagerAdapter);
    }

    mTabLayout = (TabLayout) findViewById(R.id.tab_layout);
    if (mTabLayout != null) {
        mTabLayout.setupWithViewPager(viewPager);

        for (int i = 0; i < mTabLayout.getTabCount(); i++) {
            TabLayout.Tab tab = mTabLayout.getTabAt(i);
            if (tab != null)
                tab.setCustomView(pagerAdapter.getTabView(i));
        }

        mTabLayout.getTabAt(1).getCustomView().setSelected(true);
    }
}
 
开发者ID:techstar-cloud,项目名称:techstar-shop,代码行数:23,代码来源:MainActivity.java

示例2: onTabSelected

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabSelected(TabLayout.Tab tab) {
    switch (tab.getPosition()) {
        case 0:
            mPllDirection.setVisibility(View.VISIBLE);
            mPllStyle.setVisibility(View.GONE);
            mPllOthor.setVisibility(View.GONE);
            break;
        case 1:
            mPllDirection.setVisibility(View.GONE);
            mPllStyle.setVisibility(View.VISIBLE);
            mPllOthor.setVisibility(View.GONE);
            break;
        case 2:
            mPllDirection.setVisibility(View.GONE);
            mPllStyle.setVisibility(View.GONE);
            mPllOthor.setVisibility(View.VISIBLE);
            break;
    }
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:21,代码来源:MarkActivity.java

示例3: initView

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
protected void initView() {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        getWindow().setStatusBarColor(ResUtil.getColor(R.color.colorPrimaryDark));
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    mTabLayout = findView(R.id.gank_tab_layout);
    mViewPager = findView(R.id.gank_vp);

    mViewPager.setAdapter(new GankViewPagerAdapter(getSupportFragmentManager()));

    mTabLayout.setupWithViewPager(mViewPager);

    TabLayout.Tab tab = mTabLayout.getTabAt(1);
    if (tab != null) {
        tab.select();
    }
}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:23,代码来源:GankActivity.java

示例4: changeTabNormal

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
private void changeTabNormal(TabLayout.Tab tab) {
  View view = tab.getCustomView();
  ImageView img_title = (ImageView) view.findViewById(R.id.title_iv);
  TextView txt_title = (TextView) view.findViewById(R.id.title_tv);
  txt_title.setTextColor(Color.BLACK);
  if (txt_title.getText().toString().equals("价格")) {

  } else {

  }
}
 
开发者ID:lwd1815,项目名称:Selector,代码行数:12,代码来源:ProductDetailActivity.java

示例5: initValidata

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
private void initValidata(){
    fragments=new ArrayList<>();
    for(int i=0;i<12;i++){
        OneFragment oneFragment=new OneFragment();
        Bundle bundle=new Bundle();
        bundle.putString("extra",titles[i]);
        oneFragment.setArguments(bundle);
        fragments.add(oneFragment);
    }
    //创建Fragment的 ViewPager 自定义适配器
    mPagerAdater=new CNKFixedPagerAdapter(getChildFragmentManager());
    //设置显示的标题
    mPagerAdater.setTitles(titles);
    //设置需要进行滑动的页面Fragment
    mPagerAdater.setFragments(fragments);

    info_viewpager.setAdapter(mPagerAdater);
    tab_layout.setupWithViewPager(info_viewpager);


    //设置Tablayout
    //设置TabLayout模式 -该使用Tab数量比较多的情况
    tab_layout.setTabMode(TabLayout.MODE_SCROLLABLE);
    //设置自定义Tab--加入图标的demo
    for(int i=0;i<12;i++){
        TabLayout.Tab tab = tab_layout.getTabAt(i);
        tab.setCustomView(mPagerAdater.getTabView(i));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:TabInfoFragment.java

示例6: onTabSelected

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabSelected(TabLayout.Tab tab) {

    orderBy = (int) tab.getTag();
    pager.putParam("orderBy",orderBy);
    pager.request();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:WareListActivity.java

示例7: updateTabLayoutTab

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
private void updateTabLayoutTab(TabLayout.Tab tab) {
    String channel = (String) tab.getTag();
    boolean highlight = false;
    if (channel != null) {
        ChannelNotificationManager data = mConnectionInfo.getNotificationManager().getChannelManager(channel, false);
        if (data != null)
            highlight = data.hasUnreadMessages();
    }
    tab.getCustomView().findViewById(R.id.notification_icon).setVisibility(highlight ? View.VISIBLE : View.GONE);
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:11,代码来源:ChatFragment.java

示例8: getTabTag

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@NonNull
private FileInfo getTabTag(TabLayout.Tab tab) {
    FileInfo tabTag = (FileInfo) tab.getTag();
    if (tabTag == null) {
        throw new NullPointerException("tabTag == null");
    }
    return tabTag;
}
 
开发者ID:JulianAndroid,项目名称:AppChooser,代码行数:9,代码来源:FileInfosActivity.java

示例9: onTabSelected

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabSelected(TabLayout.Tab tab) {
    mLogViewPager.setCurrentItem(tab.getPosition());
}
 
开发者ID:adityakamble49,项目名称:gofun-app,代码行数:5,代码来源:LogFragment.java

示例10: onTabReselected

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabReselected(TabLayout.Tab tab) {
    // no-op
}
 
开发者ID:TryGhost,项目名称:Ghost-Android,代码行数:5,代码来源:PostViewActivity.java

示例11: onTabReselected

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
 
开发者ID:yanzhenjie,项目名称:AddressChecker,代码行数:4,代码来源:AddressCheckActivity.java

示例12: onTabSelected

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabSelected(TabLayout.Tab tab) {
    females = !females;
    onQuery(lastQuery);
}
 
开发者ID:natario1,项目名称:Autocomplete,代码行数:6,代码来源:MaleFemalePresenter.java

示例13: initTab

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
private void initTab(){


        TabLayout.Tab tab= mTablayout.newTab();
        tab.setText("全部");
        tab.setTag(STATUS_ALL);
        mTablayout.addTab(tab);


        tab= mTablayout.newTab();
        tab.setText("支付成功");
        tab.setTag(STATUS_SUCCESS);
        mTablayout.addTab(tab);

        tab= mTablayout.newTab();
        tab.setText("待支付");
        tab.setTag(STATUS_PAY_WAIT);
        mTablayout.addTab(tab);

        tab= mTablayout.newTab();
        tab.setText("支付失败");
        tab.setTag(STATUS_PAY_FAIL);
        mTablayout.addTab(tab);


        mTablayout.setOnTabSelectedListener(this);


    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:MyOrderActivity.java

示例14: onTabUnselected

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabUnselected(TabLayout.Tab tab) {

}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:5,代码来源:TabLayoutFragment.java

示例15: onTabReselected

import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabReselected(TabLayout.Tab tab) {

}
 
开发者ID:iflove,项目名称:UIKit-ViewBlock,代码行数:5,代码来源:TabBlock.java


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