I am trying to display some textviews visible in runtime.
Here’s my code:
for (int i=0; i<arrBool.length; i++) {
arrBool[i] = r.nextBoolean();
if(arrBool[i]==true) {
textView[i].setVisibility(View.VISIBLE);
}
}
When I run the application, textviews should randomly be visible. It is working, but my problem is I have set the layout of those textviews. When I run Android Application, the visible textviews go to top left corner and loses the layout position.
How to deal with this?
Change start visibility parameter of views to
View.INVISIBLEIt will hold their own places on the layout and prevent from taking this places by other views, which is normal behavior in case of
View.GONE