Android Question HorizontalScrollView.Width vs HorizontalScrollView.Panel.Width

Tom_707

Member
Licensed User
When creating a HorizontalScrollView in the Designer, I assign a certain number to the width property.
But when the HorizontalScrollView is loaded in an Activity, the HorizontalScrollView.Panel.Width size is different to the HorizontalScrollView.Width size.
Why is this and what determines the ratio between the two dimensions?
 

Tom_707

Member
Licensed User
In most cases it is a mistake to use ScrollView or HorizontalScrollView. Use xCLV instead.
I see that xCLV doesn't have this problem because the dimensions of the xCLV are defined in the Designer, while the dimensions of the Panel have to be explicitly defined in code before you can use it.
I'll give it a go. Thanks Erel.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
There are two widths: HorizontalScrollView.Width and HorizontalScrollView.Panel.Width
HorizontalScrollView.Width is the width visible on the device.
HorizontalScrollView.Panel.Width is the width of the inner Panel. You scroll it horizontally to show the hidden parts.
These can be set in the Designer:
Width = HorizontalScrollView.Width
InnerWidth = HorizontalScrollView.Panel.Width
When you fill a HorizontalScrollView in the code you need to set HorizontalScrollView.Panel.Width to the needed value.
The principle is the same with the vertical ScrollView.
 
Last edited:
Upvote 0

Tom_707

Member
Licensed User
There are two widths: HorizontalScrollView.Width and HorizontalScrollView.Panel.Width
HorizontalScrollView.Width is the width visible on the device.
HorizontalScrollView.Panel.Width is the width of the inner Panel. You scroll it horizontally to show the hidden pasts.
These can be set in the Designer:
Width = HorizontalScrollView.Width
InnerWidth = HorizontalScrollView.Panel.Width
When you fill a HorizontalScrollView in the code you need to set HorizontalScrollView.Panel.Width to the needed value.
The principle is the same with the vertical ScrollView.
I did not see the Inner Width property!! It's right at the bottom of the Designer properties and I did not notice it!
Thanks for your input Klaus. Really appreciate it.
Its nice to have the actual question answered.
 
Upvote 0
Top