S Sub7 Active Member Licensed User Longtime User May 7, 2014 #1 Hello, i'm having some problems while trying to align and dock views added from code. For example if i were using the designer i would dock two labels in this way from the designer script: label2.top = label1.bottom, that's ok. But what when i've added all views from code? How i can dock the various views so that i will get the same result in all different screens? I've tried messing with %x and %y but i don't think is the correct way, infact the app will look different from screen to screen. For example here i am using an action bar and i want to dock my ads exactly under the action bar, the code is not complete but understandable. B4X: ActionBar.Initialize(Activity, Me, "Manager", Null, Colors.ARGB(255, 83, 90, 175), Colors.ARGB(255, 47, 35, 86), True, True, False) Activity.AddView(adbox, 0dip, 27%y - height, 100%x, height) Thank you Last edited: May 7, 2014
Hello, i'm having some problems while trying to align and dock views added from code. For example if i were using the designer i would dock two labels in this way from the designer script: label2.top = label1.bottom, that's ok. But what when i've added all views from code? How i can dock the various views so that i will get the same result in all different screens? I've tried messing with %x and %y but i don't think is the correct way, infact the app will look different from screen to screen. For example here i am using an action bar and i want to dock my ads exactly under the action bar, the code is not complete but understandable. B4X: ActionBar.Initialize(Activity, Me, "Manager", Null, Colors.ARGB(255, 83, 90, 175), Colors.ARGB(255, 47, 35, 86), True, True, False) Activity.AddView(adbox, 0dip, 27%y - height, 100%x, height) Thank you
NJDude Expert Licensed User Longtime User May 7, 2014 #2 You have to first get the height of the ActionBar, then, place your ad at that location. Upvote 0
S Sub7 Active Member Licensed User Longtime User May 8, 2014 #4 I've marked the question as solved too early: I cannot get the height of NJDude compact actionbar. B4X: Dim r As Reflector r = ActionBar r.Target = ActionBar Dim h As Int h = s.RunMethod("getHeight") Log(h) Upvote 0
I've marked the question as solved too early: I cannot get the height of NJDude compact actionbar. B4X: Dim r As Reflector r = ActionBar r.Target = ActionBar Dim h As Int h = s.RunMethod("getHeight") Log(h)
thedesolatesoul Expert Licensed User Longtime User May 8, 2014 #5 I think it is a fixed 60dip height. Upvote 0
S Sub7 Active Member Licensed User Longtime User May 8, 2014 #6 thedesolatesoul said: I think it is a fixed 60dip height. Click to expand... I will try thanks. Upvote 0