`ListView` not scrolling to exact position when a few list item are of big height - android-listview

I'm using ListView to display my dynamic content. Based on selected option, I've to scroll to some specified position in ListView. This works great when the list item height is not that big, i.e. it covers the whole screen. But when big height item are present in list, the scroll doesn't take me to proper position, instead it takes to some in between position. I tried using both of the following but same result.
listView.smoothScrollToPosition(myItems.indexOf(thisItem));
listView.setSelection(myItems().indexOf(thisItem));
Can anybody point the possible cause of the issue and also give some suggestions.

The workaround suggested here worked for me except that I called both functions, smoothScrollToPosition and setSelection, sequentially instead of using OnScrollListener. Though its not giving smooth scrolling effect but it's fulfilling my requirement. If any body can suggest a more proper solution, it's welcomed.

Related

How Do You Filter and Sort Data in a CollectionView

I have a CollectionView on a page that is displaying data from a List<> of items. I do sorting and filtering in a code behind on the page by changing the List with LINQ, and then setting the BindingContext of the view, like this:
MyView.BindingContext = FilteredData;
On IOS this works fine, every time, no problem. On Android, I can change the data a few times (it varies - normally three to five) and then the page doesn't display any data. In the debugger I can check and still see the ItemsSource has all of the items, but nothing is displayed. I then "switch" to my other view on the page, which is done by hiding one DataGrid row and showing another, then "switching" back. The data still isn't displayed, but after I do that I can run the code again that does the sorting and filtering and it starts working again - the data is displayed on the page. Not only that, but after I do that, it works every time from that point forward on Android.
I've spent hours trying every thing I can think of to try and find an event or property or anything that would indicate when this problem occurs so I can try and find a work around for it. I'm at a complete loss; wondering if there are suggestions for how to capture and/or fix this problem.
I did find a combination that worked to resolve this issue. I changed the page so that the CollectionView at issue is in the Grid row that has a non-zero (i.e. visible) height when the ContentPage loads. After doing that, the code works as expected. Previously, it was in a Grid.Row whose height was set to an absolute 0 when the page loaded, and then the height was changed to a non-zero value when a button was clicked.
FWIW, this is similar to other issues I've seen with MAUI on Android, where the visibility of certain controls as well as the order in which you modify them can interfere with rendering data binding results.
I solved sorting using a SortedList and made the list items inherit from IComparable, but I don't love the solution because a SortedList is not an ObservableCollection, and because implementing IComparable can be tricky and leaky.

Flutter horizontal text page view?

I have been scouring the web for a while about this, and have yet to find anything that works well.
I am building a flutter application that requires an “e-reader”-esque widget. This should be able to accept a looooooooooong text object, with potential paragraph indentations in the form of \n, and then have a horizontal pageview where the text that doesn’t fit in each page overflows to the next page.
So far I have tried pageview.builder where you (very slowly) add one word at a time, determine the height of the text object, and then either add another word or move to the next page if it does not fit in the viewport height. I have also tried a similar method with entire paragraphs, and a solution involving multiple locked listviews where the text scrolls equal to the viewport height whenever you swipe.
None of these implementations work particularly well, and all of them feel over-complicated.
Is there a good way of accomplishing this that anyone recommends?

DatePicker and ListPicker display incorrectly

I am using a DatePicker along with a ListPicker in my Nativescript application. However neither of these elements display correctly. I've had to blank out some sensitive information from the screenshot, but the issue is visible in the DatePicker.
It seems that the values are offset, and I cannot find out what is causing this. Has anyone else come across this issue before? Or have a fix for it?
These elements are of utmost importance to my project.
This happens because the component is inside tag ScrollView. If I remove it, works. I have tried remove padding and margin of ScrollView and nothing.
The inner StackLayout is required for the ScrollView to work properly. If I have more than one element (such as an input form - which is the scenario in my application), only the last element is displayed without the StackLayout.

Turning scrollbar, ListView into timeline slider

I've been seeing this UI technique quite often at Dribbble, mostly demonstrated on iPhone as timeline, and I am really wondering if it's possible to do so on Android. The idea is to exploit scrollbar, make it activate each row it is passing.
Consider these schematics of a list of contact.
The first one is the list (photos on the left side, names on the right) split roughly in the middle with scroll track.
The scrollbar cannot expand and has to be smaller than the smallest row. I believe it is possible to produce this kind of arrangement by combining two listviews and make them roll together.
The second one shows the screen when scrolled and when the scrollbar moves to the second row. After it stops, the second row will expand its height. All hidden elements there like address, phone, etc will show up. Also, the moment the scrollbar leaves the first row / hits the second, the first row will toggle off. It will shrink and remove all elements except name.
I have been thinking about this scenario and one key question in this technique is whether the scrollbar has the ability to activate the row it hits. The only tool I know in regard to scrolling is onScrollListener but I wonder if it's sufficient. Does anyone have any insight into such scenario ?
Thank you in advance.
I've been seen something similar to this in lots of applications. Some of them are just using ListView with design tricks to look like that, others with custom views or something else. The idea which I have in my about this implementation is using two Fragments: left and right which are placed in one FragmentActivity. Left Fragment will be your image holder, where for example you will have a ListView or some other view depending on your choice which will communicate with the Right Fragment and when LeftFragment's ListView stop scrolling, fire an event to RightFragment's ListView to scroll to position 5 for example and expand that item. Not really sure if it's the best option and if it will work properly as you want, but that's the first idea which I can think of to do some implementation like this.
Hope this help you find the right answer.

is there any method to get the row and column number in a uitextview

I am trying to achieve a task in which the user the will create notes just like iNotes.app, for this i have to give some padding from left, in my case the padding is little more than the actual iNotes(app) and the problem with this is, If I complete the whole line it goes out of view/screen and user cant see.
To solve this Issue I first I used
UIEdgeInsetsMake(0,40,0,-40);
//this thing makes the content non-scrollable horizontaly
//but the text still goes out of screen
Then I used
UIEdgeInsetsMake(0,40,0,0);
//By doing this the content becomes horizontally
//scrollable and the content appear as per scrolling.
I don't want my textview to scroll Horizontally and I want it to show the content without cutting anything.
Please guide my what should I do to tackle this problem and
If my approach is wrong please suggest any other way. Thanks in Advance :)