내 응용 프로그램에 하나의 레이아웃을 포함해야합니다. 그래서 내가 사용했습니다Android에 프로그래밍 방식으로 레이아웃을 숨기려면 어떻게해야합니까?
<include
android:id="@+id/support_layout"
android:width="match_parent"
android:height="match_parent"
layout="@layout/support"/>
나는이 자바 스크립트 파일에 포함 된 태그를 View를 사용하여 참조했습니다.
View v = (View) findViewById(R.id.support_layout);
하지만 내 코드의 일부 지점에서이 레이아웃을 숨겨야합니다. 그래서 내가 사용했다 v.GONE
그러나 그것은 은신처가 아니다. 프로그래밍 방식으로 XML에있는 텍스트 및 단추 특성을 참조하고 싶습니다. 어떻게 할 수 있습니까? 우리는 당신이 언급 한 View
것을 숨어의 실제 구현을 볼 필요가
<LinearLayout
android:id="@+id/support_layout"
android:width="match_parent"
android:height="match_parent">
<TextView
android:id="@+id/txt"
android:width="match_parent"
android:height="wrap_content"/>
<Button
android:id="@+id/btn"
android:width="match_parent"
android:height="wrap_content"
android:text="Button"/>
</LinearLayout>
게시 할 수 있습니까? – ridsatrio
사용하려고 시도합니다. v.setVisibility (View.GONE); 대신 v.GONE 만 사용하십시오. –