當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。