I know the following XML will not work, but is there any way to achieve this same effect?
....
<LinearLayout
android:layout_width="match_parent * 5"
android:layout_height="match_parent" />
....
To explain, the effect I’m trying to achieve is to make a child layout X times the size of it’s parent layout, where X is a float. In the XML example, I used 5.
The effect I’m trying to create using this is to have a ScrollView be Y size and have it’s content view be Y * X in size.
As far as I know there is no way to achieve this through XML layout. You can add the following code in your activity in order to change the height of child view. Note that the size of the view is known once android has fininished activity layout. So you may add a listener to know when layout is ready and all sizes are known. I agree with Syed Zahid Ali that you can not fit larger child in smaller parent but as far as ScrollView is concerned this code should work: