How to hide framelayout dynamically in android

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.


Change the visibility like this:

FrameLayout layout = (FrameLayout) findViewById (R.id.your_id);
layout.setVisibility (View.GONE); // or View.INVISIBLE, depending on what you exactly want

Tags:

Android