Consider a case of complex UI where you do not have space on your android application screen but you have to show some extra data on same screen?
There are two way in such a condition --
1) Switching view using LayoutInflater or fragments - but its very costly if as it will need space from visible portion
2) Using menu and action bar - unfortunately we can only show button there to perform action.
Then what should we so ? android provide Sliding drawer for such a requirement. It does not take main screen space. and it open when ever a user want to open. Most importantly , you can show any complex user interface inside a sliding drawer.
Creating sliding drawer is simple. It just need two component--
There are two way in such a condition --
1) Switching view using LayoutInflater or fragments - but its very costly if as it will need space from visible portion
2) Using menu and action bar - unfortunately we can only show button there to perform action.
Then what should we so ? android provide Sliding drawer for such a requirement. It does not take main screen space. and it open when ever a user want to open. Most importantly , you can show any complex user interface inside a sliding drawer.
Creating sliding drawer is simple. It just need two component--
- A button, will visible all the time to open and close sliding drawer. but we do not need to set listener for this.
- And Layout that will show when you open sliding drawer. I have taken a ListView inside sliding drawer
Sliding Drawer Closed |
Sliding Drawer Opened |
Action On Sliding Drawer Element |
Now you just need to download the sample application and start playing with it.
Sliding Drawer Source Code
I have browse about sliding drawer and i found a very useful link to create sliding drawer from Left to right or Right to left See Going into depth of Custom Sliding drawer
No comments:
Post a Comment
Feedback always help in improvement. If you have any query suggestion feel free to comment and Keep visiting my blog to encourage me to blogging