basically I'm building a custom scroll bar that has a table layout inside it. I'm dynamically inserting table rows into the table layout and then text views into those rows. I need to know how wide the overall scrollview is so I can take that length and divide by each textview's length. i'm using the onSizeChanged method to get the scroll views width, which works fine.
However, the problem is, I call my "add a row" method right after constructing the scroll bar. this "add a row" method is apparently being called before the scroll bar has a chance to enter into the onSizeChanged method, and as such the call to "add a row" happens while the width variable is still set to zero.
Is there a way I can stop this interleaving? Or is there a more efficient way to find the width of t开发者_运维技巧he scroll view in the constructor? Thanks!
Couldn't you postpone the call of addRow
using a handler
and its postDelayed
method?
精彩评论