Jun 4, 2011 Replies: 60 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. Attachments ScrollViewBigPanel1.jpg 18.3 KB · Views: 23,911 ScrollViewBigPanel2.jpg 28.6 KB · Views: 22,861 ScrollViewBigPanel.zip ScrollViewBigPanel.zip 8.8 KB · Views: 1,910 Last edited: Jul 11, 2017 Click to expand...
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.
Gary Miyakawa Active Member Licensed User Longtime User Jun 4, 2011 #2 Klaus, As always, thank you very much! I was close to doing what you built but I didn't have the scrollview in the "other(main)" layout. That will help me build exactly what I need! Thank you ! Gary M
Klaus, As always, thank you very much! I was close to doing what you built but I didn't have the scrollview in the "other(main)" layout. That will help me build exactly what I need! Thank you ! Gary M
S SteveBee Member Licensed User Longtime User Jun 23, 2011 #3 Thank you Klaus - great example, showing how to use 2 different layouts, with one being a 'container' for the other. Also the use of setting the Parent of a view. I was struggling with how to set up to use ScrollView for a data input form - now 'sorted'... TX
Thank you Klaus - great example, showing how to use 2 different layouts, with one being a 'container' for the other. Also the use of setting the Parent of a view. I was struggling with how to set up to use ScrollView for a data input form - now 'sorted'... TX
L Lon Member Licensed User Longtime User Feb 3, 2012 #4 I am just trying out this example. But it looks like there are times when after selecting a bottom EditText the whole Activity view gets moved up off the top of the screen when the keyboard shows. The activity title bar and device status bar are no longer visible. After that happens the only way to restore scrolling to see all the view I have to hide the keyboard. Is there any way to stop that from happening?
I am just trying out this example. But it looks like there are times when after selecting a bottom EditText the whole Activity view gets moved up off the top of the screen when the keyboard shows. The activity title bar and device status bar are no longer visible. After that happens the only way to restore scrolling to see all the view I have to hide the keyboard. Is there any way to stop that from happening?
klaus Expert Licensed User Longtime User Feb 3, 2012 #5 You can comment out this line: Code: ' scvTest.ScrollPosition = Send.Top - 10dip Best regards.
L Lon Member Licensed User Longtime User Feb 3, 2012 #6 Thanks for your help. I already tried that but it does not stop the view from being shifted off the top of the screen until the keyboard is closed. Is this a new feature of B4A to keep the current EditText input visible or does the OS automaticaly do that?
Thanks for your help. I already tried that but it does not stop the view from being shifted off the top of the screen until the keyboard is closed. Is this a new feature of B4A to keep the current EditText input visible or does the OS automaticaly do that?
klaus Expert Licensed User Longtime User Feb 3, 2012 #7 With this line : Code: 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.
With this line : Code: 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.
L Lon Member Licensed User Longtime User Feb 3, 2012 #8 Well that's the problem. I can't scroll to view all the EditText boxes with the keyboard displayed after the OS moves the view up.
Well that's the problem. I can't scroll to view all the EditText boxes with the keyboard displayed after the OS moves the view up.
thedesolatesoul Expert Licensed User Longtime User Feb 3, 2012 #9 Lon said: Well that's the problem. I can't scroll to view all the EditText boxes with the keyboard displayed after the OS moves the view up. Click to expand... Try this: http://www.b4x.com/forum/bugs-wishlist/12136-keyboard-appears-top-edit-text.html#post68090
Lon said: Well that's the problem. I can't scroll to view all the EditText boxes with the keyboard displayed after the OS moves the view up. Click to expand... Try this: http://www.b4x.com/forum/bugs-wishlist/12136-keyboard-appears-top-edit-text.html#post68090
L Lon Member Licensed User Longtime User Feb 4, 2012 #10 Well I'm not getting anywhere with this. I tried editing the Manifest Editor with all kinds of variations of : <activity android:windowSoftInputMode="stateVisible|adjustResize"/>) But nothing seemed to change in the way the view moved or the keyboard was displayed. I might be putting it in the wrong location. If I could hide the keyboard when the ScrollView was moved that would probably solve the issue but I'm reading here that one cannot do that. Edit: I needed to us: SetActivityAttribute(main, android:windowSoftInputMode,"stateVisible|adjustUnspecified") Seems to work fine now. Last edited: Feb 4, 2012
Well I'm not getting anywhere with this. I tried editing the Manifest Editor with all kinds of variations of : <activity android:windowSoftInputMode="stateVisible|adjustResize"/>) But nothing seemed to change in the way the view moved or the keyboard was displayed. I might be putting it in the wrong location. If I could hide the keyboard when the ScrollView was moved that would probably solve the issue but I'm reading here that one cannot do that. Edit: I needed to us: SetActivityAttribute(main, android:windowSoftInputMode,"stateVisible|adjustUnspecified") Seems to work fine now.
baron159 Member Licensed User Longtime User Mar 16, 2012 #11 Problem? I was using your code as an example and I have everything the same but when I try to test the Program. I get an error message that says I need to Initialize it. How do I do it? Or why is it happening?
Problem? I was using your code as an example and I have everything the same but when I try to test the Program. I get an error message that says I need to Initialize it. How do I do it? Or why is it happening?
klaus Expert Licensed User Longtime User Mar 16, 2012 #12 I tested the code from post#1, it works without any problem. So there must be something different in your code. To see what happens you need to post your project as a zip file, otherwise it's impossible to help you. Best regards.
I tested the code from post#1, it works without any problem. So there must be something different in your code. To see what happens you need to post your project as a zip file, otherwise it's impossible to help you. Best regards.
baron159 Member Licensed User Longtime User Mar 16, 2012 #13 Re: Problem Sorry About not uploading it. Here is is
klaus Expert Licensed User Longtime User Mar 16, 2012 #14 You should look more carefully at the code when you try to use one. In the original code: - In the main layout file you have the ScrollView - In the ScrollViewLayout file you have a Panel with all the views. In your code: - In the main layout file you have a Panel and one Button - In the scrllview layout file you have the ScrollView. This means that you first load a Panel with a Button and then you try to load a layout to a ScrollView that doesn't exist ! Best regards.
You should look more carefully at the code when you try to use one. In the original code: - In the main layout file you have the ScrollView - In the ScrollViewLayout file you have a Panel with all the views. In your code: - In the main layout file you have a Panel and one Button - In the scrllview layout file you have the ScrollView. This means that you first load a Panel with a Button and then you try to load a layout to a ScrollView that doesn't exist ! Best regards.
baron159 Member Licensed User Longtime User Mar 16, 2012 #15 Okay so I have switched them Around but i Get an srcllview.bal could not be found... Could you fix my code I Up loaded and reupload the correct layout Please?
Okay so I have switched them Around but i Get an srcllview.bal could not be found... Could you fix my code I Up loaded and reupload the correct layout Please?
klaus Expert Licensed User Longtime User Mar 16, 2012 #16 Here you are. Best regards. Attachments TestScroll1.zip TestScroll1.zip 6.8 KB · Views: 2,024
baron159 Member Licensed User Longtime User Mar 16, 2012 #17 Thank You so much I can start making my program finally. Ha Ha But I do have one more quick question. Can I have a Horizontal Scroll View working with a regular Scroll View? Or am I asking for too much?
Thank You so much I can start making my program finally. Ha Ha But I do have one more quick question. Can I have a Horizontal Scroll View working with a regular Scroll View? Or am I asking for too much?
klaus Expert Licensed User Longtime User Mar 17, 2012 #18 Can I have a Horizontal Scroll View working with a regular Scroll View? Click to expand... No, you can't. You can use either a vertical ScrollView or a HorizonzalScrollView but not two combined. Best regards.
Can I have a Horizontal Scroll View working with a regular Scroll View? Click to expand... No, you can't. You can use either a vertical ScrollView or a HorizonzalScrollView but not two combined. Best regards.
B BarrySumpter Active Member Licensed User Longtime User Aug 21, 2012 #19 Do I have to have a Designer Layout? If not, how can I assign the scroll view panel? Code: ... scvTest.Panel.LoadLayout("ScrollViewLayout") ... grrrr, Soon as I post I find it: Code: ScrollView1.Panel.AddView(...) And, well, Duh! And don't forget: Code: ScrollView1.Panel.Height = 1000dip Last edited: Aug 21, 2012
Do I have to have a Designer Layout? If not, how can I assign the scroll view panel? Code: ... scvTest.Panel.LoadLayout("ScrollViewLayout") ... grrrr, Soon as I post I find it: Code: ScrollView1.Panel.AddView(...) And, well, Duh! And don't forget: Code: ScrollView1.Panel.Height = 1000dip
Darren69 Member Licensed User Longtime User Sep 19, 2012 #20 Hello there, is there a trick to getting a scrollview to work with designer scripts? if I use a designer script to place my buttons and edit fields where I want them all I see is a blank Panel View that will scroll. if I delete all the code in the designer script then it works, but the buttons and editfields don't look as nice when I switch between devices. I am sure I have overlooked something but any help would be appreciated. thanks
Hello there, is there a trick to getting a scrollview to work with designer scripts? if I use a designer script to place my buttons and edit fields where I want them all I see is a blank Panel View that will scroll. if I delete all the code in the designer script then it works, but the buttons and editfields don't look as nice when I switch between devices. I am sure I have overlooked something but any help would be appreciated. thanks