I am trying to hide a RelativeLayout
using setVisibility(View.GONE)
. But it is not working. Please check my code:
<LinearLayout>
<RelativeLayout
android:id="@+id/AccelerometerView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView />
<TextView />
<TextView />
<ImageView />
</RelativeLayout>
</LinearLayout>
And I am using the following code for changing the visibility:
private RelativeLayout tv;
tv = (RelativeLayout) findViewById(R.id.AccelerometerView);
tv.setVisibility(View.GONE);
Is my approach correct? I know we can hide TextView
s like this individually. but I want to hide all three TextView
s and the ImageView
collectively in a single command. Is there any other way?