Reputation: 1671
this is a very odd issue, so I'd appreciate any feedback.
We are working on a DataGrid Component for Android : http://www.androidjetpack.com/Home/AndroidDataGrid
We are observing a very peculiar behavior with the Android TextView. Basically, the default gravity is Left:
TextView tv = (TextView) _renderer;
if (UIUtils.nullOrEmpty(getTextAlign())) {
tv.setGravity(Gravity.LEFT);
} else {
String textAlign2 = getTextAlign();
int gravity = textAlign2.equals("left") ? Gravity.LEFT
: textAlign2.equals("right") ? Gravity.RIGHT
: textAlign2.equals("center") ? Gravity.CENTER
: Integer.parseInt(textAlign2);
tv.setGravity(gravity);
}
As you can see above, fairly simple bit of code, setting the gravity of the text view.
What is peculiar is, for cells that are drawn by default, the textview aligns correctly:
But when I add new rows , the textview with gravity center, causes the textview to be blank
When I cause anything that does a refresh of the screen (like repaint the cells), the textview appears again.
Anyone have the slightest clue why the textview behaves this way?
Upvotes: 0
Views: 120
Reputation: 1671
Ok, as weird as this sounds, calling tv.measure(width,height) fixes it. We do have our own layouts (based on the default Android layouts) which might have something to do with it. Just posting this answer here in case someone else also runs into this.
Upvotes: 1