Question

Hello In my android application i want to set visibility for the text view . I am having 3 text-views and 3 check-boxes in application. i want to set visibility of text-views by checking check-boxes, i am using "setVisibility()". it is working also but problem is when i dont check check-box for text-view1 at that time it shows blank and keeps space for text-view one and then it shows text-view2 & 3. I don't want to show this blank space for text-view1. I want to show the text-view from top which i select from check-boxes.. is there any way to do this ?? Thank you.

Was it helpful?

Solution

You might be using View.INVISIBLE. However, you need to use use View.GONE in order to remove that space.

yourEditText.setVisibility(View.GONE);

OTHER TIPS

Setting the visibility to INVISIBLE leaves space for the component. Setting the visibility to GONE should remove the space

http://developer.android.com/reference/android/view/View.html#GONE

Initially Set the visibility to Gone in XML, Use Oncheck Listener & Change the SetVisibility to SetVisibility(Visible). & You can also change the Visibility by setting the visibility from int Visibility(8) to visibility (0);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top