I noticed something very useful in Google apps.
When we have dialog with big content, divider line is showing in order to emphasize ability to scroll, like in this two pictures:
But, I have no idea how to implement such behaviour using known utils.
Best example is while choosing phone ring, at the start there is only divider on the bottom, but when we start scrolling two dividers appear.
QUESTION
How to implement appearing and disappearing behaviour in dialog?
Looking at Android source code the solution is really simple. Just add this code to your custom view:
The behaviour that you want to achieve comes with a
Dialog with Scrollable Content
. Please read this document to get an idea of that.In this case, you need to create your own custom layout xml with
ListView
and couple of buttons. And you need to keep this entire layout underScrollView
.The following is just a dummy code to help you with:
Edited the dummy code with the actual one::
layout.xml
MainActivity.class:
Hope this helps!
If you have custom layout like this
you can inflate View and find ScrollView by
and set scroll TOP and BOTTOM indicators if you have TITLE above and BUTTONS below your custom view