Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide framelayout dynamically in android

Tags:

android

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

like image 703
user1310038 Avatar asked Jun 26 '12 14:06

user1310038


3 Answers

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.

like image 161
Shrikant Ballal Avatar answered Oct 31 '22 08:10

Shrikant Ballal


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
like image 6
barrel Avatar answered Oct 31 '22 08:10

barrel


You can hide or show views using setVisibility(int).

like image 1
Diego Torres Milano Avatar answered Oct 31 '22 09:10

Diego Torres Milano