long1eu / SpaceTabLayout

Not actively maintained, but PR are welcomed
1.6k stars 265 forks source link

Fragment and icon cannot be set dynamically #48

Open xipeng5 opened 3 years ago

xipeng5 commented 3 years ago

<eu.long1.spacetablayout.SpaceTabLayout android:id="@+id/spaceTabLayout" android:layout_width="match_parent" android:layout_height="77dp" android:layout_alignParentBottom="true" android:gravity="bottom" app:button_color="@color/colorAccent" app:icon_five="@drawable/ic_ico_my" app:icon_four="@drawable/design_ic_visibility" app:icon_one="@drawable/ic_ico_home" app:icon_three="@drawable/ic_ico_publish" app:icon_two="@drawable/ic_ico_circle" app:number_of_tabs="five" app:starting_position="one" app:layout_behavior="eu.long1.spacetablayout.SpaceTabLayoutBehavior" app:tab_color="@color/colorPrimary" app:text_color="#61FFFFFF" />

fragmentList.add(new HomeThis()); fragmentList.add(new Forum()); fragmentList.add(new Follow()); fragmentList.add(new Find()); fragmentList.add(new My_putstr()); spaceTabLayout.initialize(main_viewpager, getSupportFragmentManager(), fragmentList, savedInstanceState);

You can only use XML to set icons, spaceTabLayout.setTabOneIcon(R.drawable.ic_ico_home); It will be a mistake Prompt to reference null