Android Tutorial ScrollView example with a Panel higher than the screen

fdx12345

Active Member
Licensed User
Were is the code?

I am looking at the simulator and see a keyboard with multifuncitons but no code to support the keyboard view, custom characters on the keyboard, and the different modes the keyboard uses. It runs, thus the code has to be somewhere. I did not see it in the designer though I did find the textboxes and items numbers.

Bill
 

klaus

Expert
Licensed User
Sorry but I don't understand what exactly you mean.
The picture in the first post shows the internal soft keyboard.
It's different from the 'external' keyboard of the Emulator.

Best regards.
 

mvos

New Member
Licensed User
Change layout

Can I change the layout to another one. I want to use multiple layouts in my project.
if possible, how?
 

klaus

Expert
Licensed User
Yes you can.
When you want to change the layout you should use the code below:
B4X:
scvTest.Panel.RemoveAllViews
scvTest.Panel.LoadLayout("NewLayout")
But I would suggest you to use different Activities instead of different layouts in the same Activity.
That's the 'standard' Android mode of working.

Best regards.
 

adalexander

Member
Licensed User
Attached you find an example with a ScrollView with a Panel higher than the screen.

The layouts are designed in the Designer, not in the code.

There are 2 layout files:
- Main with the ScrollView.
- ScrollViewLayout has one Panel higher than the screen, 7 Label views and 7 EditText views, the Panel height is set so the last EditText view is on top of the screen when the panel's lower edge is on the lower edge of the screen.

Clicking on an EditText moves the Scrollview up to show this EditText view on top of the screen to avoid interference with the virtual keyboard.

Best regards.
With this line :
B4X:
scvTest.ScrollPosition = Send.Top - 10dip
the panel is shifted up by the code.
With this line commented out the OS does the shifting automatically.
You can set the height of the panel pnlTest to 720 (in the Designer) then when the ScrollView shows the lowest EditText view and it gets the focus the OS moves it up when the virtual keyboard is shown and moves down when the keyboard is hidden.

Best regards.
Ciao klaus now a question I asked in the forum so far only half dark, I state that I am in this program is not the good I consider it somewhat absurd, I'm a beginner, I have a screen with some pictures I would like to put 30 but do not go there and I would like to make a simple vertical scrollview and be able to put more pictures, how can I do? how do I put pictures from other designers if they do not go there physically?, someone told me to put multiple layouts within the same as you do?, at least give me help you maybe with an example? thank you ...
 

PABLO2013

Active Member
Licensed User
regards
I need to know how I could apply the scroll property to a panel using this simple method, which is described in your example testScroll1.zip, is basically the same but:

scvTest.Initialize (1000dip)
scvTest.Panel.AddView (Panel1, 0,0,500,1000)
scvTest.Panel.Height = Panel1.Height

but it shows me an error:


upload_2014-4-15_22-1-27.png

how to do it?

thanks.
 

klaus

Expert
Licensed User
You need to post more code, without knowing what you have done and how, it's difficult to give you a concrete answer.
The best would be to post your project as a zip file (IDE menu Files / Export As Zip).
 

PABLO2013

Active Member
Licensed User
THANKS FOR YOUR PROMPT RESPONSE
BASICALLY NEED TO MAKE A SCROLL PANEL THAT OPENS AND OFF BY A BUTTON, THE PANEL MAY HAVE ANY VIEW ... I SEND A ZIP WHICH IS JUST AN ATTEMPT BY THE TIME DOES NOT WORK ...
THANKS
 

Attachments

klaus

Expert
Licensed User
Soryy for answering only today, but I was three days on travel.
BASICALLY NEED TO MAKE A SCROLL PANEL THAT OPENS AND OFF BY A BUTTON ...
What do you mean with this ?
There is no such button in your code.
Attached your modified code.
 

Attachments

PABLO2013

Active Member
Licensed User
thank you you are very kind
sorry for my English
your example is fine for me, but I see no such express very well.

basically it is an activity that has a botton that opens and closes a panel with scrolling features.
thank you very much beforehand.

thank you you are very kind
sorry for my English
your example is fine for me, but I see no such express very well.

basically it is an activity that has a botton that opens and closes a panel with scrollingfeatures.
thank you very much beforehand.
 

Attachments

klaus

Expert
Licensed User
You need to be more precise on what you want !
If you show the ScrollView full screen your Butons will be hidden and you cannot come back !
One button could do both, showing and hiding the Scrollview.
Do you want to have the button allways visible and show or hide the ScrollView on the same Activity or show the ScrollView in another Activity and go back with the Back button.
 

luciano deri

Active Member
Licensed User
Hy, can i create a layout to set a line of listview? How can sum object in designer list? Thanks. Thomas
 

klaus

Expert
Licensed User
Sorry, but I don't understand what exactly you want to do.
can i create a layout to set a line of listview?
What do you mean with 'set a line of listview' ?
How can sum object in designer list?
What do you mean with 'sum object in designer list' ?
 

luciano deri

Active Member
Licensed User
Sorry, but I don't understand what exactly you want to do.
What do you mean with 'set a line of listview' ?
What do you mean with 'sum object in designer list' ?
I need show row and colum of a table SQLite, in eclipse i had use a listview and i define the lyout of a row with a number of edit texts such as the colums. Can i do the same operation in B4A?
I have install a library for GridView but ther is'nt the objet in designer / addview. What have i forgot to do?
Thanks.
 

klaus

Expert
Licensed User
I'm sure that trying to do it in the Designer is not the best way.
Is the row number always the same ?
If no, you need anyway to add the views in the code.

I need show row and colum of a table SQLite, in eclipse i had use a listview and i define the lyout of a row with a number of edit texts such as the colums. Can i do the same operation in B4A?
You can do something similar with a ScrollView, you could have a look at the SQLExample in User's Guide.
The Table class uses a ScrollView too.

You could also have a look at this example, it uses a ScrollView and a panel with views for each row.

You can also use a WebView to display a table. This is used in the SQLiteLight examples.
 

luciano deri

Active Member
Licensed User
I'm sure that trying to do it in the Designer is not the best way.
Is the row number always the same ?
If no, you need anyway to add the views in the code.
You could also have a look at this example, it uses a ScrollView and a panel with views for each row.
Ok, i do by the ScrollView and panel, there isn't a limit of row because is a app for add element in a table.
I don't understand why i must do Activity.AddView(scvMain, 0, 0, 100%x, 100%y), if scvMain is the ScrollView insert in Designer.
Now my App is almost ok, only problem is that the table scroll but is not requayred because there are few rows that layout can contain. I would like that the scroll si active only if there are there are more rows those displayed. How can i solve this problem? Thanks
 

klaus

Expert
Licensed User
I don't understand why i must do Activity.AddView(scvMain, 0, 0, 100%x, 100%y), if scvMain is the ScrollView insert in Designer.
If the ScrollView is added in the Designer you must not use Activity.AddView(scvMain, 0, 0, 100%x, 100%y) !
I would like that the scroll si active only if there are there are more rows those displayed. How can i solve this problem?
You must adjust the ScrollView.Panel.Height according to the row height and number.
 
Top