🤖 Android/개발

[Android] 레이아웃/뷰 숨기기 (setVisibility)

선주 2021. 10. 3. 15:57

INVISIBLE

- 뷰가 보이지 않지만 공간은 차지한다.

TextView component = findViewById(R.id.component);
component.setVisibility(View.INVISIBLE);

쇠고기 아래의 한 줄을 숨긴 상태

 

GONE

- 뷰가 보이지 않으며 공간도 차지하지 않는다.

TextView component = findViewById(R.id.component);
component.setVisibility(View.GONE);

쇠고기 아래의 한 줄을 숨긴 상태