Android Question CustomScrollView does not scroll full page only half?

ronovar

Active Member
Licensed User
Longtime User
I have atatched simple project demo...when i press on remote up it scrolls dull page when i press down button on remote controll it scrolls half page...how to fix this?

Here is what i get half scroll picture:

picture.png

How to fix to get full scrolling up and down?
 
Last edited:

mangojack

Well-Known Member
Licensed User
Longtime User
Ok can you make example of 150items or more in scrollview
Thanks.

Here is a completely fresh and barebones example of a Vertical ScrollView centering the item panels after Scroll Finnish 'event' .
It seems to work much better than the other examples (200 Items)

The calculations used are from a horizontal SV example by @klaus .
As I stated in post#14 .. I am unsure of a few factors used in the calculation ..

If this works for you (and your remotes) .. your CLV can be adjusted.
But I start to wonder whether you really need to use a Custom List View for this ?

Have a try and let me know ;)
 

Attachments

  • ScrollView Timer Example.zip
    13 KB · Views: 139
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
I try this code and all items is half scrolled see picture attached...when i change only this code:

B4X:
Dim pHeight As Int = 125dip

Scroller is working as it should be scrolling up and down goes smoth and centered...so no half ways scrolling..if i put back 250dip it scrolls half way...

I need CustomListView because i put panel to CustoListItem and in panel i have one bitmap three labels and three small bitmaps...if this is possible to add panel to ListView? ListView working scrolling as expected..there i use SelectItem And scroolls automatically...but i don't know how to add panels to ListView item...if you can write simple demo how to add panel to ListView problem will be solved....
 

Attachments

  • 00.png
    00.png
    89.5 KB · Views: 141
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
I try this code and all items is half scrolled see picture attached...when i change only this code:

B4X:
Dim pHeight As Int = 125dip

Scroller is working as it should be scrolling up and down goes smoth and centered...so no half ways scrolling..if i put back 250dip it scrolls half way...

Change the panel height to whatever works for you ... ! ;)

I need CustomListView because i put panel to CustoListItem and in panel i have one bitmap three labels and three small bitmaps...if this is possible to add panel to ListView? ListView working scrolling as expected..there i use SelectItem And scroolls automatically...but i don't know how to add panels to ListView item...if you can write simple demo how to add panel to ListView problem will be solved....

I am not suggesting ListView ..
The last example ( Post #21 ) is a simple example using ScrollView only ... NOT CustomListView class (which uses a SV)
Add whatever extra views you need to ' pnlItems ' ... before adding it to ScrollView (the example is well commented).

If This does not suit you ... continue to use the CLV and copy all relevant code for Timer and OnTouch event to the CLV

Glad to see it is working ... hint, hint, like, like, :)
 
Last edited:
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
I have adjusted the example slightly based on above info ..
Keep them separated and use the one that works best for you ..

Edit .. New example uploaded .. size now set at 167dips
 

Attachments

  • ScrollView Timer Example.zip
    13 KB · Views: 117
Last edited:
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
I added this to touch event and in log it is not called (maybe becaus ei im using remote control) can you post how to call with parameters activity_keypressup this touch event with parameters? I think that touch is not called using remote control buttons and that is why is scrolling only half.

B4X:
Private Sub ScrollView1_Touch(ViewTag As Object, Action As Int, X As Float, y As Float, MotionEvent As Object) As Boolean
Log("touch...")

And another question is how to update existing items in inserted panel? (I need to update labelEPG.Text = "NewText" label.EPGDesc.Text = "NewDesc")...i im calling this to remove panel and insertnew but it slow...can you write for CustomListView one Public Sub UpdatePanelItemsAt(Parameters).

B4X:
clvMasterCh.RemoveAt(ScrolledChannel)
                    clvMasterCh.InsertAt(ScrolledChannel, CreateChannelListMaster(ScrolledChannel, clvMasterCh.AsView.Width, 167dip, Channels(ScrolledChannel,3), Channels(ScrolledChannel,2), EPGs(ScrolledChannel,0), EPGs(ScrolledChannel,1).SubString2(11,16), EPGs(ScrolledChannel,2).SubString2(11,16), EPGs(ScrolledChannel,3)), 167dip, ScrolledChannel)

Erel write in his CustomListView class tutorial that you can update items at any time...but i im not finding example how to to this.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
I added this to touch event and in log it is not called (maybe becaus ei im using remote control) can you post how to call with parameters activity_keypressup this touch event with parameters? I think that touch is not called using remote control buttons and that is why is scrolling only half.

It might be wise to start new thread for this question .. I cannot help you

And another question is how to update existing items in inserted panel? (I need to update labelEPG.Text = "NewText" label.EPGDesc.Text = "NewDesc")...i im calling this to remove panel and insertnew but it slow...can you write for CustomListView one Public Sub UpdatePanelItemsAt(Parameters).

Please read again ... post#21 , post#23

It is a Simple ScrollView example ... (with comments). Add more items to pnlItems

repeat ..
If This does not suit you ... continue to use the CLV and copy all relevant code for Timer and OnTouch event to your project.

You have added views to the CLV Before ! (Do you definitely need to use CustomListView ?)
 
Last edited:
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
I found where the error is why not scrolling...but need code to have 167ip items height...the problem was in:

B4X:
'ADDVIEW - CustomListViews
    Activity.AddView(clvMasterCh.AsView, 97dip, 389dip, 407dip, 167dip)

    'ADD - Master Items
    For Ch = 1 To 100
        clvMasterCh.Add(CreateChannelListMaster(Ch, clvMasterCh.AsView.Width, 167dip, "hayatbih.png", "Channel "&Ch, "Inspektori za životinje", "12:45", "13:10", "Na prvoj liniji: Epizoda 3 Prikazuje se život leoparda u divljini kako lovi i preživljava..."), 83.5dip, Channels)
    Next

Just need to put half value of item Height at the end of clvMasterCh.Add and scrolling is working...perfectly up and down....so i replace , "167dip, Channels)" with ", 83.5dip, Channels)" and scroller works excellent...but now i need to make this half value to have height 167dip...when i put this i get two panels i need to get one like in first post picture:

B4X:
Activity.AddView(clvMasterCh.AsView, 97dip, 389dip, 407dip, 334dip)

clvMasterCh.Add(CreateChannelListMaster(Ch, clvMasterCh.AsView.Width, 334dip, "hayatbih.png", "Channel "&Ch, "Inspektori za životinje", "12:45", "13:10", "Na prvoj liniji: Epizoda 3 Prikazuje se život leoparda u divljini kako lovi i preživljava..."), 167dip, Channels)

clvMasterCh(CLV) is then double height, panel is correct size(167dip) scrolling working as it should be smooth, fast and without error...i try on 1000 items and all is working excellent...so the problem is how can i set CLV to 167dip and that the CLV and Panel will be equal in height 167dip
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
..so the problem is how can i set CLV to 167dip and that the CLV and Panel will be equal in height 167dip

we have gone from 167dip, 125dip and back to 167dip !

one last time .. !

B4X:
 Dim pHeight as Int = 167dip   'This is used 3 times in code below ...

'@@ This sets the Scrollview Height (Viewing Window)   = pHeight
Activity.AddView(clvMasterCh.AsView, 97dip, 389dip, 407dip, pHeight)

'@@ There is 2 References here ..  The Last one "pHeight, Channels)" Must = pHeight
'Edit  I am now confused what the first argument pHeight does ?
clvMasterCh.Add(CreateChannelListMaster(Ch, clvMasterCh.AsView.Width,pHeight, "hayatbih.png", "Channel "&Ch, "Inspektori za životinje", "12:45", "13:10", "Na prvoj liniji: Epizoda 3 Prikazuje se život leoparda u divljini kako lovi i preživljava..."), pHeight, Channels)


I have uploaded revised example (back to 167dip) .. see Post#24

Can you please answer ..

1. Does Example post#24 work for you ? ... As Is - without change ? (If Not then I cannot help you any more)


Thank you
 
Last edited:
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
so the problem is how can i set CLV to 167dip and that the CLV and Panel will be equal in height 167Dip
Here is a fresh and basic CustomListView example using Scroll Timer to center panels within the ScrollView window.
 

Attachments

  • CLV Scroll Timer Example.zip
    15.9 KB · Views: 137
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
Thank you for your support now is not half scrolling it is 3/4 of the scrolling..i will not be using this CLV for master scroller (only for slave scroller) and have put fixed panel with all items inside(bitmap, label, progressbar) and will only update it with fresh variables values when pressing Up and Down key.

Another question is how can i animate only bitmap from CLV (i have SlaveCLV witch holds list of 12items) so that animate fading bottom or top like in this video (see 1:47...1:53).


I think that this is possible with b4a because i see that it have animate and animatelayout (duration in ms) etc...can you post some example?
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Another question is how can i animate only bitmap from CLV (i have SlaveCLV witch holds list of 12items) so that animate fading bottom or top like in this video (see 1:47...1:53).

Please start a new thread for this question...
 
Upvote 0
Top