How do I calculate HorizontalScrollView length including its child view - android-layout

I want to calculate length of horizontal scroll view and I want to identify when user scroll to its end.

I solved it.
we have to use Hscrollview.getMeasuredWidth();
this method have to be used after all child updated in that scrollview completely.
After UIThread completed its work.

Related

How to avoid usage of Task.Delay while scrolling to a particular point in Scroll View as I am adding children in runtime which are out of view?

Here, I have used a scroll view and children are added upto visible height and the other children are added in runtime while scrolling down. Hence I need to scrollTo a particular point like Scrollview.ScrollTo(x,y) for this I need to calculate y by adding children height.Height is calculated by using delay to bring the view in screen first and I calculate. But need to calculate once the children displayed while scrolling without delay
ScrollViewer.ScrollTo(0, (int)totalheight);
await Task.Delay(500);
totalheight += this.CalculateHeight(ScrollView.GetChildrenAt(i));
Where children view height is return in the last method, but without delay the view become null.

Align CN1 Component depending on viewable area

I would like to align a component initially relative to the visible part of the containing parent (Container). The containing parent is planned to be a scrollable Tabs page but only that component should be visible initially on the page when selecting the tab.
In my example I want to position a Container (variable: root) at the bottom of the visible area of its parent. My current approach is to get the height of root and the height of root.getParent() and then set its top-margin as: root.getUnselectedStyle().setMarginTop(parentsHeight - rootsHeight);, but the result is not as expected. How can I manage this?
check the illustrations below:
intention
result
Note: when I add the root component programmatically then my approach works!
finally I could detect the cause of the problem. The descirbed approach is correct, but I also had to pay attention for a specific point! Beneath the taps bar I have an additional component by default which gets hidden when initializing the containig form. Thus parentsHeight is lower than expected because I missed to revalidate the containing layout.

how to set lwuit textarea scrolling false

I want to add large string content to a container dynamically.
There are 60 different contents(strings) to be displayed in this container.
To add the string to container, I am adding a TextArea(empty border with 100% transparency).
The problem is that TextArea offers scroll and I do not want it to scroll. Instead I want to grow(increase height) according to content. I am unable to achieve this.
Can you help me out with this?
Or can I use any other component for the purpose?
I am using LWUIT with J2ME.
You can derive text area and return false for isScrollableY() although it should generally work seamlessly even if you don't do that (since your parent layout is scrollable). Is it possible you changed the text area and don't revalidate the parent form on the EDT?
There are problems with text area layout when it is modified by a separate thread (race condition with the layout code).
First put the TextArea.setSingleLineTextArea(false) , and grow by content true.

QTreeView: Show "loading" message when expanding item

With PyQT and a QTreeView, I need to display a "loading" message or a "spinning wheel" when the user expands an item, because the childs are retrieved by making a http request.
Any ideas on how to implement this?
Thanks
If the time taken to retrieve the child items is relatively short (say, a few seconds), then by far the simplest solution is to display a busy/wait cursor.
You can either set the cursor on the treeview:
treeview.setCursor(QtCore.Qt.BusyCursor)
# retrieve and insert child items ...
treeview.unsetCursor()
or set it globally:
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor))
# retrieve and insert child items ...
QtGui.QApplication.restoreOverrideCursor()
But other solutions will be much more complicated than this.
For instance you could show a QProgressBar in the status bar, or perhaps use a QMovie to display an animated icon somehow.

Zooming Entire ScrollView

I have a series of PDFScrollViews (like the one given in the sample code on Apple Developer) inside a UIScrollView but I want them to all scroll at once no matter where in the ScrollView the Pinch-Zoom action happens, currently this only happens to the one PDFScrollView that is pinched and the other stay the same size. The basic goal I'm trying to achieve here is to make a series of PDFs act as one homogeneous PDF to the user.
implement scroll view's delegate method
-(UIView *) viewForZoomingInScrollView: (UIScrollView *) ScrollView
And return your PDF view.
hope it 'll work

Resources