Android expandablelistview can not display the last group when expanded - android

I'm trying to implement a FAQ screen in my project and I wanted to use ExpandableListView. I display question as a text in GroupView and answer as a text in ChildView. If items can fit into screen, there's no problem, it works as it should. But when there's more items than the screen height and I have to scroll, this problem occurs that when I expand the last item, it acts like it's expanded but I can not scroll to the child view.
Any ideas or experiences on this issue?
Here's the screenshot (as you can see, scrollbar shows that it's expanded and there's place to scroll, but when I try to scroll, no luck) :
EDIT: I found out that this problem is because I'm using a WebView inside child row, when I switched to TextView it works as expected. How can I achieve the same result with WebView?

In your getGroupView() method of BaseExpandableListAdapter, give view=null as the first line of the method.

Related

Scroll a View before ListView like lollipop phone app

I have a layout with a linearLayout (top layout) and a listview under this.
What I want to do is like the phone app in Lollipop:
With the scrollbar I can scroll the contact list (top layout doesn't move)
When scroll the list with the finger, first the top layout is scrolling and once it is not visible anymore the listview scroll. When the top layout is visible the scrollbar doesn't move.
Someone has any idea how to do this trick?
What I'm thinking :
I can add the top layout to the header of listview, but the scrollbar take count of the header. And if I scroll with the scrollbar, the top layout will scroll
Trying to set a scrollListener to the listview, and translate the top view, but don't think it will be good and the scrollY is not available for listView
I think I can do something with a scrollView for the root layout, but I know it is not good to put a listview inside a scrollview.
I don't find any proper way to do this kind of feature...
EDIT: To be more clear, I want to translate the listview before I'm able to scroll the listview itself. Problem is when translate listview, the listview height will not expand.
I am also getting this problem in version 5.1 in lower version it's working fine.Try to use in 5.0 As it STABLE verson, also check another scrolling bug in 5.1 in this link here I could not comment so posting this as answer.

How to detect if an HorizontalScrollView is showing scroll bars or not

I have an HorizontalScrollView in my design, which I populate with a variable number of items. The problem I have is that sometimes I populate it with many items, so the ScrollView shows scroll bars. That's OK, but I would like to check this situation and show a Previous and Next buttons in this case.
How can I do this?
I don't think ScrollView has a scroll listener. Synchronise ScrollView scroll positions - android might help you for creating a custom one.

ListView with footer attached, smoothScrollToPosition not functioning correctly

I'm working with a rather large layout that includes a ListView and a LinearLayout beneath it as a footer. I first tried to wrap this in a ScrollView to make the whole layout scrollable, but ran into problems due to both the ListView and the ScrollView being incompatible with each other since they both have scrollable features. So, a workaround was to include the LinearLayout as a footer to the ListView.
Now, in the LinearLayout, I have buttons at various places that the user can click to return to the top of the page. The behaviour I am getting from this is odd, to say the least.
If I have not scrolled down too far, the buttons function normally. However, if I scroll down a bit too far, then clicking the button (even the same buttons that previously worked) will result in the layout scrolling up to roughly half of the way up the listview instead of the top.
Here is the method that does the scrolling, it's rather simple:
public void backToTop(View view) {
lv = (ListView)findViewById(R.id.listview);
lv.smoothScrollToPosition(0);
}
This method is triggered when any of the buttons are clicked.
I have also tried to use the "scrollTo(0, 0)" function, but that failed to do anything.
Any help would be appreciated!
**edit: After testing some more, it appears as though the point where scrolling does not seem to function properly anymore is when the listview is no longer visible on the page. As soon as I scroll past it, the buttons begin to function incorrectly.
Edit 2: SOLVED. My solution: I changed the line
lv.smoothScrollToPosition(0);
to:
lv.setSelected(0);
This seems to give the correct behaviour for all my buttons at any position that the user has placed their screen. Using setSelected does not seem to have the side-effect that I was expecting of automatically triggering the click-event. Hooray!
My solution: I changed the second line of my backToTop method:
lv.smoothScrollToPosition(0);
to:
lv.setSelected(0);
This seems to give the correct behaviour for all my buttons at any position that the user has placed their screen. Using setSelected does not seem to have the side-effect that I was expecting of automatically triggering the click-event. Hooray!

Scrollview inside listview issue in android

I am adding a listview inside a scrollview in xml that xml(Screen) is loading from the middle screen. In my design I have a top part like a textview and a list view and middle part like editext and bottom part like button. Page is loading from the middle part. If it scrolls I can only see the above part. I want to load the page from above part. Can anybody tell me what the problem is and how to resolve it?
Thanks
Use android:fillViewport="true" as an attribute in your scrollview tag and it will fill up the screen.
Actually there is no need to use ScrollView with ListView. Use ListView only, you will be able to scroll the items in a ListView.
You should never use a ScrollView with a ListView, because ListView
takes care of its own vertical scrolling. Most importantly, doing this
defeats all of the important optimizations in ListView for dealing
with large lists, since it effectively forces the ListView to display
its entire list of items to fill up the infinite container supplied by
ScrollView.
found it here
using smoothScrollTO(0,0) to fix the issue

Android listview (array adapter) custom scrolling

I would like to change the default behaviour of my listview, so when im scrolling to the last item, the list will keep scrolling untill the last item is at the top of the list.
default behaviour stops scrolling when the last item is fully in view.
Any ideas on how i can go about this pre 2.3?
Thanks,
Totem.
In case anyone is interested in the solutions available it either:
1) add to the list view padding, that solution forces you to play around with the fading edge property since it gets sifted because of thee padding. also this method might not work well if your using a transparent background because items will be rendered and visible under the padding area. Although this could be fixed by entering the list into a relative layout and making sure to draw something over that area.
2) add transparent items to the listview for offset and not set them as enabled to avoid dividers, just need to make sure to change getItemCount and getItemTypeCount and so on if your if your item isn't really inside your adapter as per my case.
I went with option two.
Thanks,
Totem.

Categories

Resources