In my application I have a scrolling view. During the life of my application I dynamically add new views to the scrolling view. I can add the views with little issue, however I cant get the dimensions right. Here is a sketch of my desired layout:
In the image I have a screen with dimensions Width
by Height
. It contains a HorizontalScrollView
(or maybe a RecyclerView
but I'm not sure how to use this one) which will grow when views are added to it. I want each item that gets added into the view to have a width equal to one fifth the screen-height and have the matching heights. I can make this work if I hardcode the width of the inflated view, however, my view wont be the same aspect ratio on all phones.
Note: I've tried using a PercentRelativeLayout, but I couldn't get it to work. Not sure how to solve this issue... any ideas?
Note on the bounty: I will accept answers that are in Java or C# (Xamarin)!! My project is in Xamarin so it would be nice if it works for that, or if it can be easily adapted to work in C#