Android - XML layout vs programmatic -
I am trying to use a custom class with a relative layout that spreads the view, and some buttons < / P>
(Forgive me to post a link instead of an image, apparently I'm not enough yet)
Currently this DP Is hard with heights (see XML below), and there are two problems with it:
- This is acceptable only on my Nexus 7 screen, And no other device
- The 'Draw method' on two custom methods still provides the height and width canvas which corresponds to the solution of the device
if If I try to set Layout_Height, then try to pick up each custom full screen, which looks like a bullet point 2, but clearly I do not want to.
What I want to achieve is a relative layout with two custom ideas, which is shown in the picture, but in the dimensions of the screen that came on the screen, it will be enhanced and custom view Canvas really knows how big this is on the screen. How do i do this Edit: This is because "Programming vs." is that I think it will not be bad to override the solution, but I do not know how it will interact with XML.
My XML is below:
& lt; LinearLayout xmlns: android = "http: // schemas Android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" Android: layout_width = "match_parent" Android: layout_height = " Match_parent "Android: orientation =" vertical "tool: reference =" trapezoid view "& gt; & Lt; LinearLayout Android: layout_width = "match_parent" Android: layout_height = "0dp" Android: layout_weight = "0.5" & gt; & Lt; Com.sportsim.virtualcricket.view.SideProfileViewAndroid: id = "@ + id / side_profile_view" Android: layout_width = "match_parent" Android: layout_height = "match_parent" & gt; & Lt; /com.sportsim.virtualcricket.view.SideProfileView> & Lt; / LinearLayout & gt; & Lt; LinearLayout Android: layout_width = "match_parent" Android: layout_height = "0dp" Android: layout_weight = "0.5" & gt; & Lt; Com.sportsim.virtualcricket.view.BirdsEyeViewAndroid: id = "@ + id / birds_eye_view" Android: layout_width = "match_parent" Android: layout_height = "match_parent" /> & Lt; / LinearLayout & gt; & Lt; LinearLayout Android: layout_width = "match_parent" Android: layout_height = "0dp" Android: layout_weight = "0.25" Android: orientation = "horizontal" & gt; & Lt; Android: ID = "@ + ID / Button 1" Android: layout_width = "0dp" Android: layout_height = "match_parent" Android: layout_weight = "0.5" Android: text = "button" /> & Lt; Android: AD = "@ + ID / Button 2" Android: Layout_Wind = "0 DP" Android: layout_height = "match_parent" Android: layout_weight = "0.5" Android: text = "button" /> & Lt; / LinearLayout & gt;
It would be easy to use LinearLayout and Weight . I have given an example below but I can not test this time However it should provide some directions.
& lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http: // Schemas.android.com/tools" Android: layout_width = "match_parent" Android: layout_height = "Match_parent" android: orientation = "vertical" tool: reference = ".traceator view" & gt; & Lt; Com.sportsim.virtualcricket.view.SideProfileViewAndroid: Android: Android: layout_width = "match_parent" android: layout_height = "0dp" Android: layout_weight = "0.5" /> And lieutenant; Com.sportsim.virtualcricket.view.BirdsEyeViewAndroid: ID = "@ + ID / Birds_A_View" Android: layout_width = "match_parent" Android: layout_height = "0dp" Android: layout_weight = "0.25" /> & Lt; LinearLayout Android: layout_width = "match_parent" android: layout_height = "0dp" Android: layout_weight = "0.25" Android: orientation = "horizontal" & gt; & Lt; Android: ID = "@ + ID / Button 1" Android: layout_width = "0dp" Android: layout_height = "match_parent" Android: layout_weight = "0.5" Android: text = "button" /> & Lt; Android: AD = "@ + ID / Button 2" Android: Layout_Wind = "0 DP" Android: layout_height = "match_parent" Android: layout_weight = "0.5" Android: text = "button" / & gt; & Lt; / LinearLayout & gt; & Lt; / LinearLayout & gt;
Comments
Post a Comment