How to modify the length of the navigation bar indicator at the bottom of tablayout in Android
preface
I believe everyone is familiar with tablayout. It should be used frequently in development, but the length of the bottom navigation bar is fixed. You need to change the length yourself. You haven't found a way for a long time. After reading the official suggestion, you can modify the length you want through mapping. In fact, it's just a matter of a few lines of code.
Look at the code:
Leftdip and rightdip are left-right spacing, which can be set according to your own needs and called directly.
Many students have problems. The source code is attached here. You can see:
Fragment:
Layout:
summary
The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.