Disappearing and Appearing Button

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Disappearing and Appearing Button

Postby sunxin8086 » Mon Jan 18, 2010 6:11 am

I have searched on the internet and haven't found a clear answer so I'd try here. I hope there is a standard way to do this since I saw this in a few apps.

What I want to achieve is make the button disappear after 5 seconds when there is no action on the screen, and when users tap the screen, the button will appear. An example is the zoomin and zoom out button in the built-in browsers in android. And the buttons might be shared by multiple activities (prev and next pages), is there a way to just write one layout for the buttons and reuse it in different activities? Thanks.
sunxin8086
Freshman
Freshman
 
Posts: 6
Joined: Wed Jan 06, 2010 6:27 am

Top

Postby jwei512 » Mon Jan 18, 2010 10:24 am

Well you are probably going to want to call the setVisibility method for the button.

For instance, you could have an onTouchListener, and inside when the screen gets touched you can call

button.setVisibility(View.INVISIBLE)

or

button.setVisibility(View.VISIBLE)

etc
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest