this might help to answer your question
please note that there is differnce in View.Gone and View.Invisible
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Demo extends AppCompatActivity {
private RelativeLayout layoutfortexttopSelfView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wi_fi_demo);
layoutfortexttopSelfView.setVisibility(View.GONE); //this will hide the view
layoutfortexttopSelfView.setVisibility(View.Visible); //this will unhide the view
//this will invisible and visible the view
layoutfortexttopSelfView.setVisibility(View.INVISIBLE);
layoutfortexttopSelfView.setVisibility(View.Visible);
}
}
when we do view.gone the layout gone hide and the layout constrains get adjusted as per the things which is still visible in the screen
but when we do INVISIBLE, the layout doesnt disappear , its present in the xml but not visible , then in that case the layout doent disturb .
Hope this might help please ask if i am not clear .