Android Tutorial ScrollView example with a Panel higher than the screen

luciano deri

Active Member
Licensed User
If the ScrollView is added in the Designer you must not use Activity.AddView(scvMain, 0, 0, 100%x, 100%y) !
You must adjust the ScrollView.Panel.Height according to the row height and number.
Other question: i want select a row and delete this. The key of my tabel is an auto incremet integer, i can use the panel.tab to allin the tabel with the scrollview? afther delete how refresh the screen? Tanks.
 

klaus

Expert
Licensed User
You can remove the panel at the row to delete and change the Top property of all panels below the row to delete.
If you use the Tag property to memorize the row index you'll need to decrement them by 1 for all row indexes higher than the deleted row index.
 

luciano deri

Active Member
Licensed User
Very, good.
You can remove the panel at the row to delete and change the Top property of all panels below the row to delete.
If you use the Tag property to memorize the row index you'll need to decrement them by 1 for all row indexes higher than the deleted row index.
Very good. Can i set the color of row selected and unselected?. When i select a row isn't difficult change color in event click but i must set standard color in the row select before. I think that i must pilot the pointer for list but i don't understand how.
 

klaus

Expert
Licensed User
You should set a ProjectGlobal variable to hold the selected row index like Dim RowIndex = -1 As Int. Set to -1 if no row is selected.
When you click on a row, in the Click event routine you know with RowIndex the currently selected row and you can reset it's standard color, then update RowIndex and set the 'selected' color for the new row.
You could also unselect a selected row with a similar principle.
 

RauchG

Active Member
Licensed User
Hello Klaus,

maybe you have a tip for me.

When you open the Activity only the labels and edit fields are visible.

If the panel is scrolled all the way up, Back and Next buttons are visible below. I'm on the panel a hidden label field where I display my bottom position. This value I use for displaying the button.

lblSrollEnd.Text = position
If lblSrollEnd.Text> = 1770 Then Visible Buttons.

Now I can not find a solution for multi-equipment. How do I get a fixed static value for the "1770". For example, 10 inch Tablet is the value much smaller.

greeting
Günter
 

klaus

Expert
Licensed User
Sorry, but I don't understand exactly your problem.
What does this value 1770 exactly represent ?
Are the Back and Next buttons on the ScrollView.Panel or outsides of the ScrollView.
Couldn't you use the postion of your hidden Label for the test, the ScrollView.Panel.Height ?
 

RauchG

Active Member
Licensed User
Sorry, but I don't understand exactly your problem.
What does this value 1770 exactly represent ?
Are the Back and Next buttons on the ScrollView.Panel or outsides of the ScrollView.
Couldn't you use the postion of your hidden Label for the test, the ScrollView.Panel.Height ?

The Back and Next buttons are on the scrollview form and outside the scrollview and not on the panel form. If I scroll the panel all the way up my hidden label has a value of 1776, if the value of the hidden label is> = 1770. If the Previous and Next buttons visible.

How do you mean?
Could not you use the postion of your hidden label for the test, the ScrollView.Panel.Height?

When opening the Activiy I say, as in your example:
scvHDB.Panel.LoadLayout ("01_01_00HDBForm")
scvHDB.Panel.Height = pnlHDB.Height
 

klaus

Expert
Licensed User
In scvHDB_ScrollChanged replace this line
If lblSrollEndKontrolle.Text >= 1770 Then '1830 Then
by this line
If Position >= pnlHDB.Height - scvHDB.Height - 10dip Then
You don't need lblSrollEndKontrolle.Text.
10dip is the height where the Buttons are visible, you can change it to your convenience.
 

RauchG

Active Member
Licensed User
In scvHDB_ScrollChanged replace this line
If lblSrollEndKontrolle.Text >= 1770 Then '1830 Then
by this line
If Position >= pnlHDB.Height - scvHDB.Height - 10dip Then
You don't need lblSrollEndKontrolle.Text.
10dip is the height where the Buttons are visible, you can change it to your convenience.
So cool.

Many thanks
 

solfinker

Member
Licensed User
Hello.
How do I change the code so that the width of the scrollview fulls the screen?

I have tried
B4X:
Activity.LoadLayout("main")
Activity.Width = 100%x
scvTest.Panel.LoadLayout("cloro")
scvTest.Panel.Height = pnlCloroFondo.Height
and
B4X:
Activity.LoadLayout("main") 
scvTest.Panel.LoadLayout("cloro")
scvTest.Panel.Height = pnlCloroFondo.Height
scvTest.Panel.width =100%x
and
B4X:
Activity.LoadLayout("main")
scvTest.Panel.LoadLayout("cloro")
scvTest.Panel.Height = pnlCloroFondo.Height
pnlCloroFondo.width = 100%x
but nothing happens

Thank you
 

klaus

Expert
Licensed User
You should set the Horizontal Anchor of scvTest to BOTH in the Designer.

Or you could use this code., not advised:
B4X:
Activity.LoadLayout("main")
scvTest.Panel.LoadLayout("cloro")
scvTest.Width = 100%x
scvTest.Panel.Width = 100%x
scvTest.Panel.Height = pnlCloroFondo.Height
You tried Activity.Width = 100%x, this will do nothing because Activity.Width is equal to 100%x !
 

solfinker

Member
Licensed User
I am still doing sth wrong.
AutoScaleAll ??
Only one variant (320x600)?notyet.PNG
Thank you!
 

Attachments

solfinker

Member
Licensed User
Sorry.
I didn't read the first part or your advise.
Now it works smoothly
 

hibrid0

Active Member
Licensed User
Hi I follow this for my small project, I create the layaout for load on the scrollview, that work fine.
Create a script on designer for the layout for load on the scrollview, but when I run the app, all views on the layout are not in order like the script, just like put on the designer.
 
Top