Android – How to hide framelayout dynamically in android

android

I want to hide framelayout dynmically in android, How I can achieve this.

Best Answer

provide an id attribute to your frameLayout by defining it in xml file as:

android:id="@+id/someID"

and in code, write following:

FrameLayout layout = (FrameLayout)findViewById(R.id.someID);
layout.setVisibility(View.GONE); 

You can also use

View.INVISIBLE

which means the element will be still there.