Android Question Panels, Scrollviews etc

xode

Member
Licensed User
Another noob question,

In the wysiwyg designer I created a layout called main, matched connected device and then added
a scrollview, a panel and 2 buttons the buttons are at either end of the panel (see picture attached).

Then for code I have

Activity.LoadLayout("main")
Panel1.RemoveView
ScrollView1.Panel1.AddView( Panel1, 0, 0, ScrollView1.Width, ScrollView1.Panel.Height )

I expect to be able to scroll the two buttons up and down the display. What I get is a white
rectangle about 1/2 the size of the physical screen (a 7" Tab) and button1. The other button2
is nowhere to be seen and neither can I scroll it into view? Any ideas?

http://imageshack.com/a/img924/3578/ZtAKBj.jpg


30uwp3r.jpg
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
The main layout should include the ScrollView. It should be anchored to all sizes:

SS-2016-03-04_11.03.12.png


The inner height should be set to 1200.

The second layout should include the panel. Its height should be set to 1200. Disable AutoScaleAll for this layout.

The code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("main")
   ScrollView1.Panel.LoadLayout("2")
End Sub
 
Upvote 0
Top