本文整理汇总了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);
}
}
示例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;
}
示例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();
}
示例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 );
}
}
示例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));
}
}
示例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());
}
示例7: onTabUnselected
import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override
public void onTabUnselected(Tab tab) {
// nothing
}
示例8: onTabReselected
import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override
public void onTabReselected(Tab tab) {
// nothing
}
示例9: onTabSelected
import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override
public void onTabSelected( Tab tab ) {
handleSelectionTab( tab );
}
示例10: onTabReselected
import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override
public void onTabReselected( Tab tab ) {
handleSelectionTab( tab );
}
示例11: onTabUnselected
import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override
public void onTabUnselected( Tab tab ) {
}
示例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();
}
示例13: Listener
import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
Listener(TabLayout tabLayout, Observer<? super Tab> observer) {
this.tabLayout = tabLayout;
this.observer = observer;
}
示例14: onTabSelected
import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override public void onTabSelected(Tab tab) {
if (!isDisposed()) {
observer.onNext(tab);
}
}
示例15: onTabUnselected
import android.support.design.widget.TabLayout.Tab; //导入依赖的package包/类
@Override public void onTabUnselected(Tab tab) {
}