
android: id = "@ + id/h_scrollview_1"
android: layout_width = "match_parent"
android: layout_height = "100sp"
android: background = "# 778899"
>android: id = "@ + id/linearlayout_1"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
android: background = "# 778899"
android: orientation = "horizontal"
>
android: id = "@ + id/v_scrollview_1"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
android: background = "# 998877"
android: layout_below = "@ + id/h_scrollview_1"
>android: id = "@ + id/relativelayout_1"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
android: background = "# 007f7f"
>
As shown in yellow font, I use the xml in a horizontal scroll bar, and a vertical scroll bar, hoping accounted for one-third of the horizontal scroll bar, two-thirds of the vertical scroll bar in the xml file I do not know how to specify parameters, just write a 100sp, think again to update the program based on the pixel size of the screen.
At the prompt Logcat, the horizontal scroll bar is displayed by default 172 height, I used after layout is set to 283, the last line and automatically reverts to 172, I do not know what is the reason?
Do not use the layout settings reliable?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Their research found that when the interface is redrawn, especially after the above layout is updated, affecting the following layout, they are refreshed, the position of which controls are automatically calculated.
Reply:
You this demand, the most appropriate is to use android: layout_weight specified proportion of the various spaces, which can adaptively various resolutions.
Reply:
How should specify the percentage of the parameters it?
Reply:
HorizontalScrollView the android: layout_weight = 2, ScrollView in android: layout_weight = 1, They the android: layout_height = "match_parent".
But there you have other LinearLayout and RelativeLayout, may affect the results.
Try it.
No comments:
Post a Comment