S Sanxion Active Member Licensed User Longtime User Jun 9, 2016 #1 Hi all I am attempting to centre a view in the left parameter of .AddView: B4X: Page1.RootPanel.AddView(adTopBanner,(Page1.RootPanel.Width - 320dip) /2 ,0%y,320dip, 50dip) However, the ad is not appearing in the centre but at the left most position? Thanks
Hi all I am attempting to centre a view in the left parameter of .AddView: B4X: Page1.RootPanel.AddView(adTopBanner,(Page1.RootPanel.Width - 320dip) /2 ,0%y,320dip, 50dip) However, the ad is not appearing in the centre but at the left most position? Thanks
JanPRO Well-Known Member Licensed User Longtime User Jun 9, 2016 #2 Try B4X: Log(Page1.RootPanel.Width) and be sure the width is not 0. It's recommend to add the view in the Page_Resize sub. Jan Upvote 0
Try B4X: Log(Page1.RootPanel.Width) and be sure the width is not 0. It's recommend to add the view in the Page_Resize sub. Jan
Erel B4X founder Staff member Licensed User Longtime User Jun 10, 2016 #3 JanPRO said: It's recommend to add the view in the Page_Resize sub. Click to expand... I don't completely agree. It is best to add the views with the designer. If that is not possible then add them when the page is created and call SetLayout in the Page_Resize event. Page_Resize can be called multiple times. Upvote 0
JanPRO said: It's recommend to add the view in the Page_Resize sub. Click to expand... I don't completely agree. It is best to add the views with the designer. If that is not possible then add them when the page is created and call SetLayout in the Page_Resize event. Page_Resize can be called multiple times.