BottomBar: RequestLayout() improperly called

I’ve got these warnings whenever the Tab Bar activity is launched.

W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{2af626cd V.ED.... ......ID 109,111-215,168 #7f0e0075 app:id/bb_bottom_bar_title} during layout: running second layout pass
W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{1a2f2b82 V.ED.... ......ID 32,120-161,177 #7f0e0075 app:id/bb_bottom_bar_title} during layout: running second layout pass
W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{2de35293 V.ED.... ......ID 9,120-185,177 #7f0e0075 app:id/bb_bottom_bar_title} during layout: running second layout pass
W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{3da522d0 V.ED.... ......ID 0,120-194,177 #7f0e0075 app:id/bb_bottom_bar_title} during layout: running second layout pass
W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{ccb62c9 V.ED.... ......ID 37,120-157,177 #7f0e0075 app:id/bb_bottom_bar_title} during layout: running second layout pass

Any idea on what might be the problem?

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 22
  • Comments: 30 (2 by maintainers)

Most upvoted comments

@burhanaksendir if that’s teh fix, then it will be coming in the next days because that’s part of the change i’m working on

https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/BottomBarBadge.java#L32

I resolved this using android.support.v7.widget.AppCompatTextView:

class BottomBarBadge extends android.support.v7.widget.AppCompatTextView {

Yep. There was no manual requestLayout method calls that were out of place, so I guess the system calls that for us whenever we update the width / height, paddings, etc. while the onMeasure method hasn’t finished.

There’s a lot of optimizations to be done through the library. The weird updateTitleBottomPadding() method for example should be absolutely unnecessary. It was introduced when merging some PR like almost a year ago and to this day, I don’t know why it needs to be here at all.

@roughike this is because we trigger a layout phase while on the layout phase, i think what we are missing is that we are not leveraging the measuring phase to calculate the sizes and just lay them out on the payout phase.

Confirmed on the latest dev branch, looking into it.

@nextdimension @JDDJJ well this library wasn’t maintained for a while, And i just started helping about like 2 months ago, but, this is just like a side thing, i’m like 60% done with a huge refactoring in how the BottomBar works, which would make it better while still being backwards compatible. But, i’m super swamped with work this weeks that i haven’t been able to finish it. But, don’t worry @nextdimension i know how to do it, is already solved, the missing thing is not that is other things before the next release is ready. But, you are always free to use other libraries, or if you want you can contribute Pull Request to improve it as well, i try to take a look to PR as they arrive.

when will this bug be fixed? this bug will cause UI stop when app open for long time.