Open kevintanhongann opened 6 years ago
I saw this method: setText(String... tagTexts).
mSwitchMultiButton.setText("点个Star", "狠心拒绝")
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
Any way to add tabs programmatically in code?