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


Java Tab类代码示例

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


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

示例1: initPartner

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
private void initPartner() {
    if (this.mPartnerTab == null) {
        this.mPartnerTab = (TabLayout) LayoutInflater.from(this).inflate(R.layout.qd, null,
                false);
        this.mPartnerTab.setVisibility(8);
        Tab tabOne = this.mPartnerTab.newTab();
        Tab tabTwo = this.mPartnerTab.newTab();
        this.mPartnerTab.addTab(tabOne, true);
        this.mPartnerTab.addTab(tabTwo, false);
        this.mPartnerTab.setTabMode(0);
        this.mPartnerTab.setTabTextColors(ContextCompat.getColor(this.ctx, R.color.il),
                ContextCompat.getColor(this.ctx, R.color.hb));
        this.mPartnerTab.setSelectedTabIndicatorColor(ContextCompat.getColor(this.ctx, R
                .color.hb));
        this.mPartnerTab.setPadding(0, 0, 0, 0);
        LayoutParams params = new LayoutParams(-2, -1);
        params.gravity = 17;
        this.toolbar.addView(this.mPartnerTab, params);
        this.mTitle = (TextView) View.inflate(this, R.layout.n7, null);
        this.mTitle.setVisibility(8);
        this.toolbar.addView(this.mTitle, params);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:MainActivity.java

示例2: addNewRemoteTab

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
/**
 * Add a new {@link TabLabel}.
 *
 * @param newTabLabel
 * 		The  new {@link TabLabel}.
 * @param helper
 * 		Use helper to refresh UI before removing  {@link TabLabel}.
 * @param viewForSnack
 * 		The anchor for {@link Snackbar} for result-messages.
 *
 * @return A {@link Tab} that hosts the new {@link TabLabel}. It might be {@code null} if the {@code newTabLabel} has same wording(label) equal to
 * label of an existing {@link TabLabel} in  {@link #mCachedTabLabels}.
 */
public
@Nullable
Tab addNewRemoteTab( TabLabel newTabLabel, TabLabelManagerUIHelper helper, View viewForSnack ) {
	//Same label should not be added again.
	for( TabLabel cached : mCachedTabLabels ) {
		if( cached.equals( newTabLabel ) ) {
			Snackbar.make( viewForSnack, viewForSnack.getContext().getString( R.string.lbl_sync_same_label, newTabLabel.getLabel() ),
						   Snackbar.LENGTH_SHORT
			).show();
			return null;
		}
	}
	final Tab tab = helper.addTab( newTabLabel );
	mHandler.postDelayed( new Runnable() {
		@Override
		public void run() {
			tab.select();
		}
	}, 300 );
	mCachedTabLabels.add( newTabLabel );
	addNewRemoteTabInternal( newTabLabel, viewForSnack );
	return tab;
}
 
开发者ID:XinyueZ,项目名称:cusnews,代码行数:37,代码来源:TabLabelManager.java

示例3: handleSelectionTab

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
private void handleSelectionTab( Tab tab ) {
	if( tab.getPosition() == 0 ) {
		mKeyword = tab.getTag() == null || ( mSearchMenu != null && !MenuItemCompat.isActionViewExpanded( mSearchMenu ) ) ? "" : tab.getTag()
																																	.toString();
	} else {
		mKeyword = tab.getText()
					  .toString();
	}
	clear();
	getData();
	if( !mBinding.del.isHidden() ) {
		mBinding.del.hide();
	}
	mSelectedIndex = tab.getPosition();
}
 
开发者ID:XinyueZ,项目名称:cusnews,代码行数:16,代码来源:MainActivity.java

示例4: removeTab

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
/**
 * Remove a {@link Tab} from {@link Tab}s.
 *
 * @param tab
 * 		{@link Tab}
 */
@Override
public void removeTab( Tab tab ) {
	mBinding.tabs.removeTab( tab );
	mBinding.del.hide();
	if( mBinding.tabs.getTabCount() < 2 ) {
		mBinding.tabs.setVisibility( View.GONE );
	}
}
 
开发者ID:XinyueZ,项目名称:cusnews,代码行数:15,代码来源:MainActivity.java

示例5: subscribeActual

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override protected void subscribeActual(Observer<? super Tab> observer) {
  if (!checkMainThread(observer)) {
    return;
  }
  Listener listener = new Listener(view, observer);
  observer.onSubscribe(listener);
  view.addOnTabSelectedListener(listener);
  int index = view.getSelectedTabPosition();
  if (index != -1) {
    observer.onNext(view.getTabAt(index));
  }
}
 
开发者ID:JakeWharton,项目名称:RxBinding,代码行数:13,代码来源:TabLayoutSelectionsObservable.java

示例6: onTabSelected

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override
public void onTabSelected(Tab tab) {
    Log.d("onTabSelected() Switching to tab %s", tab.getPosition());
    // switch to page when tab is selected
    viewPager.setCurrentItem(tab.getPosition());
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:7,代码来源:MainActivity.java

示例7: onTabUnselected

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override
public void onTabUnselected(Tab tab) {
    // nothing
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:5,代码来源:MainActivity.java

示例8: onTabReselected

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

示例9: onTabSelected

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override
public void onTabSelected( Tab tab ) {
	handleSelectionTab( tab );
}
 
开发者ID:XinyueZ,项目名称:cusnews,代码行数:5,代码来源:MainActivity.java

示例10: onTabReselected

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

示例11: onTabUnselected

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

示例12: doSearch

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
/**
 * Start searching.
 */
private void doSearch() {
	Tab tab = mBinding.tabs.getTabAt( 0 );
	tab.setTag( mKeyword );
	tab.select();
}
 
开发者ID:XinyueZ,项目名称:cusnews,代码行数:9,代码来源:MainActivity.java

示例13: Listener

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
Listener(TabLayout tabLayout, Observer<? super Tab> observer) {
  this.tabLayout = tabLayout;
  this.observer = observer;
}
 
开发者ID:JakeWharton,项目名称:RxBinding,代码行数:5,代码来源:TabLayoutSelectionsObservable.java

示例14: onTabSelected

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override public void onTabSelected(Tab tab) {
  if (!isDisposed()) {
    observer.onNext(tab);
  }
}
 
开发者ID:JakeWharton,项目名称:RxBinding,代码行数:6,代码来源:TabLayoutSelectionsObservable.java

示例15: onTabUnselected

import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override public void onTabUnselected(Tab tab) {
}
 
开发者ID:JakeWharton,项目名称:RxBinding,代码行数:3,代码来源:TabLayoutSelectionsObservable.java


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