當前位置: 首頁>>代碼示例>>Java>>正文


Java TabLayout.getTabAt方法代碼示例

本文整理匯總了Java中android.support.design.widget.TabLayout.getTabAt方法的典型用法代碼示例。如果您正苦於以下問題:Java TabLayout.getTabAt方法的具體用法?Java TabLayout.getTabAt怎麽用?Java TabLayout.getTabAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.design.widget.TabLayout的用法示例。


在下文中一共展示了TabLayout.getTabAt方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: theme

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
private void theme(View root) {
        int colorPrimary = getResources().getColor(R.color.colorPrimary);
        int accentColor = getResources().getColor(R.color.colorAccent);
        boolean isPrimaryDark = true;
        int contentColor = GeneralUtils.resolveColor(getContext(), android.R.attr.textColorPrimaryInverse, 0);

        root.findViewById(R.id.top_bar_house).setBackgroundColor(colorPrimary);
        ((TextView) root.findViewById(R.id.single_storage_item_text_view)).setTextColor(contentColor);

        TabLayout tabLayout = (TabLayout) root.findViewById(R.id.tab_layout);
        tabLayout.setBackgroundColor(colorPrimary);
        tabLayout.setTabTextColors(ColorUtil.withAlpha(contentColor, .75f), contentColor);
        tabLayout.setSelectedTabIndicatorColor(contentColor);
        try {
            for (int i = 0; i < tabLayout.getTabCount(); i++) {
                TabLayout.Tab tab = tabLayout.getTabAt(i);
                Field fTabView = TabLayout.Tab.class.getDeclaredField("mView");
                fTabView.setAccessible(true);
                View tabView = (View) fTabView.get(tab);
                GeneralUtils.setBackgroundDrawable(tabView, MaterialValueHelper.getSelectableItemBackground(getActivity(), isPrimaryDark, false));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


        TintHelper.setTint((ImageView) root.findViewById(R.id.up_button), GeneralUtils.resolveColor(getActivity(), android.R.attr.textColorPrimaryInverse, 0));
        ((TextView) root.findViewById(R.id.cancel)).setTextColor(accentColor);
        ((TextView) root.findViewById(R.id.choose)).setTextColor(accentColor);

//        ATH.setStatusbarColor(d.getWindow(), ColorUtil.darkenColor(colorPrimary));
    }
 
開發者ID:GlennioTech,項目名稱:MetadataEditor,代碼行數:33,代碼來源:FolderPickerDialog.java

示例3: process

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
public void process(@NonNull Context context, @Nullable String key, @NonNull View view, @NonNull String suffix) {
    final TabLayout tl = (TabLayout) view;
    final ColorResult result = getColorFromSuffix(context, key, view, suffix);
    if (result == null) return;
    final int color = result.getColor();

    if (mTextMode) {
        tl.setTabTextColors(ATEUtil.adjustAlpha(color, UNFOCUSED_ALPHA), color);
    } else if (mIndicatorMode) {
        tl.setSelectedTabIndicatorColor(color);

        final ColorStateList sl = new ColorStateList(new int[][]{
                new int[]{-android.R.attr.state_selected},
                new int[]{android.R.attr.state_selected}
        },
                new int[]{
                        ATEUtil.adjustAlpha(color, UNFOCUSED_ALPHA),
                        color
                });
        for (int i = 0; i < tl.getTabCount(); i++) {
            final TabLayout.Tab tab = tl.getTabAt(i);
            if (tab != null && tab.getIcon() != null)
                tab.setIcon(TintHelper.createTintedDrawable(tab.getIcon(), sl));
        }
    }
}
 
開發者ID:RajneeshSingh007,項目名稱:MusicX-music-player,代碼行數:28,代碼來源:TabLayoutTagProcessor.java

示例4: initView

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
private void initView(){
    tabLayout=(TabLayout)findViewById(R.id.tabLayout);
    viewPager=(ViewPager)findViewById(R.id.viewPager);
    myFragmentPagerAdapter=new MyFragmentPagerAdapter(getSupportFragmentManager());

    viewPager.setAdapter(myFragmentPagerAdapter);

    tabLayout.setupWithViewPager(viewPager);
    tabLayout.setTabMode(TabLayout.MODE_FIXED);
    TabLayout.Tab tab2 = tabLayout.getTabAt(1);
}
 
開發者ID:Luodian,項目名稱:Shared-Route,代碼行數:12,代碼來源:sendLocationActivity.java

示例5: onCreate

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_voice);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    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:tortuvshin,項目名稱:health,代碼行數:28,代碼來源:VoiceActivity.java

示例6: onCreate

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);



        mAuth = FirebaseAuth.getInstance();
//        mAuth.signOut();
        dbr_users = FirebaseDatabase.getInstance().getReference().getRoot().child("users");

        // fragment aufsetzen
        ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
        MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
        if (viewPager != null)
            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(0).getCustomView().setSelected(true);
        }


        // Authentifizierungsmodul
        mAuthListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser user = firebaseAuth.getCurrentUser();
                if (user != null) {
                    // User is signed in
                    Log.d("LoginTry", "onAuthStateChanged:signed_in:" + user.getUid());
                    getInformationFromFB(user.getUid());
                } else {
                    // User is signed out
                    Log.d("LoginTry", "onAuthStateChanged:signed_out");
                    startActivity(new Intent(MainActivity.this, LoginActivity.class));
                }
                // ...
            }
        };


    }
 
開發者ID:burliEnterprises,項目名稱:chapp-messenger,代碼行數:52,代碼來源:MainActivity.java


注:本文中的android.support.design.widget.TabLayout.getTabAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。