First, my apologies for the title. I thought long and hard to choose a more descriptive title but couldn't really find one.
I have a screen with a header (variable length - using sliding action bar), a middle part (scrollview) and a bottom part for showing ads (fixed length). I am able to write the screen using RelativeLayout but what I would really like to do is this:
- If the scrollview's content (the middle part) is not long enough to fill the screen (including header), I would like to show the ad at the bottom of the screen
- If the scrollview's content + header is longer than the screen, I would like to show the ad BELOW the scroll view's contents, meaning it's not visible unless the user scrolls to the bottom of the fragment.
Imagine the scroll view's content as a short text or an image + a long text. For the first case, the scroll view content will be short and therefore I'd ideally show the ad at the bottom of the screen since I have enough space but if it's image + text, it will be larger than the screen height and as such, I would like to show the ad after the user has scrolled to the bottom.
The reason I want to do this is so that the ad doesn't necessarily take space if there's useful content on the screen (user experience).
Is there anyway to achieve this in android without writing my own custom layout? If so, which view would you recommend?
Many thanks in advance,