UI Advanced Container Elements
- SlidingDrawer
- Hides content off screen, and allows the user to drag a
handle to bring the content on screen.
- Can be used vertically or horizontally.
- Has two children views: the handle and the content attached to the
handle.
- Used as an overlay inside layouts, e.g., inside a
FrameLayout.
- The size of the SlidingDrawer can be less than
match_parent, but the content should match_parent to
fill the drawer.
- Attributes
- orientation - vertical or horizontal
- handle - id of the handle (required)
- content - id of the handle (required)
- allowSingleTap - indicates whether the drawer can
be opened/closed by a single tap on the handle.
- animateOnClick - indicates whether the drawer
should be opened/closed with an animation when the handle
is clicked.
- Example
UIScrollTableDrawerExample.java
ui_scroll_table_drawer_layout.xml
drawer_handle.png
- TabHost
- A tabbed window
- Contains a TabWidget to select the tab, and a
FrameLayout to show the tab contents.
- Attributes
- ViewFlipper
- Flips between a set of views, on demand or automatically
- Attributes
- autoStart - to start flipping automatically
- flipInterval - time between flips
- Example
UIViewFlipperExample.java
ui_viewflipper_layout.xml
happy1.png
happy2.png
happy2.png
- Container UI Challenge:
- Write an app that flips three images, and has a drawer containing
a button that toggles the flipping on and off.
When the button has been pressed and the flipping is toggles, the
drawer closes itself automatically.
- You'll need to use the isFlipping, startFlipping,
and stopFlipping methods of the ViewFlipper
class.
you'll need to use the animateClose method of the
SlidingDrawer class.
- Solution