本文整理匯總了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) {
}