Tutorial :android RelativeLayout, trying to vertically center a TextView when the TextView below has no text


I have a ListView that contains an Image on the left of two vertically-oriented TextViews using a RelativeLayout. When both TextViews have text it looks fine. Sometimes the TextView on the bottom won't have any text, and the problem is that the entire layout is several pixels above where it should be because it still reserves that space for text when there isn't any making the entire list have annoying blank gaps. I remember seeing an example of where someone made the layout not reserve the space, but I can't remember how he did it. Could somebody please enlighten me?


Try to change visibility of bottom text.

When text is not present please exec setVisibility(View.INVISIBLE) or setVisibility(View.GONE) on this view.

I hope that will help.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »