I have implemented a custom Layout that extends RelativeLayout. It displays lots of different elements that are created at run-time and is scrollable in both dimensions usin
Just had this same problem and finally figured it out.
The "problem" is that you are extending RelativeLayout
, which is a subclass of ViewGroup
. I found that I had no problem doing what you described in your question to get a custom View
to display scrollbars, but when I extended ViewGroup
or one of its subclasses, no scrollbars appeared.
I finally remembered that ViewGroup
s, by default, don't draw themselves. I added one line to my custom ViewGroup
constructor:
setWillNotDraw(false);
What do you know, the scrollbars appeared!
Hope that helps.