Android Question SrollView

brodmuehler

Member
Licensed User
Longtime User
Hi

I am trying to get a Scrollview to work but I am failing. No idea what I do wrong. I attached my project that I just started. Not much in it yet ....

Could someone please have a look and give me a hint what I am missing - that would be great. Thanks a lot in advance.
Kind regards
René
 

Attachments

  • gliderlog.zip
    19.8 KB · Views: 132

mangojack

Well-Known Member
Licensed User
Longtime User
You are creating the Scrollview in code .. so you must manually add it to the activity.
B4X:
scv.Initialize(1000dip)
Activity.AddView(scv,50dip,50dip,500dip,1000dip)
scv.Panel.LoadLayout("LayoutDef")
 
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
Hallo

That sounds logic. I will try this and I am sure that will work.

Thanks a lot. Highly appreciated.
Best wishes
Rene
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, but this will not work correctly:
Activity.AddView(scv,50dip,50dip,500dip,1000dip)
1000dip is the height of the internal panel of the scrollview not the scrollvoew height.
Use something like this, adding the scrollview and setting the internal panel height:
Activity.AddView(scv, 0, 0,100%x, 100%y)
scv.Panel.Height = xxx

Then you are loading the layout once onto the svrollview in main.
But you also load it in the Definitionen module.
So, in which Activity do you want to show the scrollview?
You must add it in the Activity where you want to show it.
You cannot add it in Main and expect seeing it in Definitionen.
An advice for the LayoutDef:
Put all the views onto a panel, even bigger than the screen.
Load the layout onto the scrollview.
And set scv.Panel.Height = pnlLayoutDef.Height
 
Last edited:
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
Hi Klaus

I tried so much yesterday that I am not surprised that I did something stupid like loading the view in Main and expecting to appear in Definitionen.

I will do like you are suggesting in your response and then it will work. Thanks a lot for your help. Super.

Best wishes
Rene
 
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
Sorry, but this will not work correctly:
Activity.AddView(scv,50dip,50dip,500dip,1000dip)
1000dip is the height of the internal panel of the scrollview not the scrollvoew height.
Use something like this, adding the scrollview and setting the internal panel height:
Activity.AddView(scv, 0, 0,100%x, 100%y)
scv.Panel.Height = xxx

Then you are loading the layout once onto the svrollview in main.
But you also load it in the Definitionen module.
So, in which Activity do you want to show the scrollview?
You must add in the Activity where you want to show it.
You cannot add it Main and expect seeing it in Definitionen.
An advice for the LayoutDef:
Put all the views onto a panel, even bigger than the screen.
Load the layout onto the scrollview.
And set scv.Panel.Height = pnlLayoutDef.Height


Hi Klaus

how do I reference the pnlLayoutDef.height? When I add the line as you suggested above "scv.Panel.Height = pnlLayoutDef.Height" I get an error message saying that "pnlLayoutDef" is not declared, so I still missing something.

Thanks again.
René
 
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
You need to give more information.
How did you define the layout for the scrollview?
Did you put all the views on a panel?
Post your project it would be much easier to help.


Hi Klaus

I found my mistake now and it works as you suggested. Thanks a lot again.

Next step is now to learn how CustomListViews work and how I can connect them to a sqlite DB .

Best wishes
Rene
 
  • Like
Reactions: eps
Upvote 0
Top