Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to add tabs programmatically in code? #23

Open
kevintanhongann opened this issue Dec 2, 2018 · 2 comments
Open

Any way to add tabs programmatically in code? #23

kevintanhongann opened this issue Dec 2, 2018 · 2 comments

Comments

@kevintanhongann
Copy link

Any way to add tabs programmatically in code?

@matiasgualino
Copy link

I saw this method: setText(String... tagTexts).

mSwitchMultiButton.setText("点个Star", "狠心拒绝")

public SwitchMultiButton setText(String... tagTexts) {

@AnasLakhani
Copy link

Yes Dont place array in arrays.xml
place in java files in that way ::

private String[] tabTexts1 = {"General", "Password", "Address", "Avator"};

public void setSwitchMultiButton2 () {

    switchMultiButton2.setText(tabTexts1).setOnSwitchListener(new SwitchMultiButton.OnSwitchListener() {
        @Override
        public void onSwitch(int position, String tabText) {

            if (position == 0){

                viewPager1.setCurrentItem(0);

            } if (position == 1) {

                viewPager1.setCurrentItem(1);

            } if (position == 2) {

                viewPager1.setCurrentItem(2);

            } if (position == 3) {

                viewPager1.setCurrentItem(3);
            }

        }
    });



}

Set Like this
Hope u like it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants