本文整理汇总了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);
}
}
示例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;
}
}
示例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();
}
}
示例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 {
}
}
示例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));
}
}
示例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();
}
示例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);
}
示例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;
}
示例9: onTabSelected
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabSelected(TabLayout.Tab tab) {
mLogViewPager.setCurrentItem(tab.getPosition());
}
示例10: onTabReselected
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabReselected(TabLayout.Tab tab) {
// no-op
}
示例11: onTabReselected
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
示例12: onTabSelected
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabSelected(TabLayout.Tab tab) {
females = !females;
onQuery(lastQuery);
}
示例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);
}
示例14: onTabUnselected
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
示例15: onTabReselected
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
@Override
public void onTabReselected(TabLayout.Tab tab) {
}