Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Hiding and repositioning views programatically

I have a fragment where I want to hide and reposition a few textviews and imagebuttons programatically in case they are empty but I also want to put the other two that are below them, on top of the screen where those were in the first place.

.setTop doesnt seem to do move the view

`if (tr.getName().isEmpty()) {
        tv1.setVisibility(View.INVISIBLE);
        tv2.setVisibility(View.INVISIBLE);
        imgb1.setVisibility(View.INVISIBLE);
        tv3.setVisibility(View.INVISIBLE);
        tv4.setVisibility(View.INVISIBLE);
        imgb2.setVisibility(View.INVISIBLE);
    }`

I make those invisible but how do I set the other components on top of the screen, basically on top of those that are invisible?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You should use:
view.setVisibility(View.GONE)

instead :
view.setVisibility(View.INVISIBLE)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading