Android - ExpandableListView in ScrollView - android

Ok, i know this isn't to do, but i need to do it!
My layout is this :
When a group is tapped and the text is shown the view increases its height and, having a scroll view, it scrolls. When the user scrolls, the image is scrolled also, so if the text under the group tapped is too long, the image scrolls.
I'm sure there is a way to do it.
I'm a newbie of Android, i'm an iOS dev.
EDIT :
This is the result i want, just like in the iOS version of this app :
This is the standard view when the user open this layout.
And this is when the user open a group of the expandable list and scroll to read all the text.
This is what i want.

Related

Swipe and tap to enlarge recycler view

I have a recycler view which has its items in a card view. The recycler view gets its data from a sql database within the app . Now I want to implement two features to this recycler view items. First , whenever the individual cards are tapped , I want them to enlarge and display more data and should shrink back when tapped again. It is not like the case of expandable list view where it expands into a child list view. I want the height of the card to increase and just show some more information and buttons. Second I want the items to swipe left . I know there is a feature for that in recycler view , but I want to customise the swipe feature. Swipe from right should be locked , and when swiped from left , It should not go off list completely. It should show two buttons and should go off list only when one of the buttons is clicked. I have been looking , but there is no proper explaination anywhere. Please guide me through this process.
For your first question, set the adapter layout_height to wrap_content and set the buttons visibility to GONE. Implement the OnClick listener in the RecyclerView adapter and set the visibility of the buttons to VISIBLE if GONE and GONE if VISIBLE or use a boolean to alternate the visibility.
For your second question, this might help:
https://www.learn2crack.com/2016/02/custom-swipe-recyclerview.html
How can I make my Android SwipeableCardViews more like the IOS 7 mail app (swipe to show buttons)
https://github.com/daimajia/AndroidSwipeLayout

verticalHorizontal scroll Listview for android TV app

I had a requirement of implementing a Header List view with horizontal scroll items as rows (similar to UI shown by using Browse fragment of leanback library) for android TV app . I browsed on net and used verticalHorizontalscroll view using Two way View example and added a header text.As the app is for android TV , both Horizontal and Vertical scrolling should happen on keys Navigation and should show a selector to the focused item.
The vertical Scrolling and Horizontal scrolling is not happening properly.
VericalScrolling:
while scrolling up and down using Keys the entire row is not scrolling it is showing only half of the row on screen. When i set setItemsCanFocus is true it taking two key presses to scroll entire row. One for scrolling row and one for scrolling the header text.
HorizontalScrolling: Horizontal scrolling is not happening until we set setItemsCanFocus is true only after this it is showing selector on focused item . It is taking multiple Right key presses to scroll one item to right.
Please anyone tell me how can i get smooth scrolling both horizontal and vertical along with selector for TV. Is there any other way i can implement this.
Thanks,

How to stop scroll in current position?

In my app i need to scroll user's page to up until the spinners reach the top of screen and then scroll up only postfeed. So posts will be in the scrollview, but what i need to do to stop all page scroll at the spinners on top? Can you give me xml-layout code and java if it necessary too.
My user's page link

Custom List Scrolling behavior in List View - Android

I'm trying to do something similar to PlayStore app. On the app details page you can see a scroll view which has a horizontal scrolling - "app screen images" and also some details below it like, Description, Reviews, etc...
My Question is: In the PlayStore app, when you scroll the image screen shots horizontally, the vertical scroll is locked and the whole view dose not scroll. Only when you touch and scroll some where below the screen shot images , you can scroll to see other details.
Here is where I'm stuck, Is it possible to do the same with a listView? I have a list view with a custom header View which detects for horizontal scroll gestures, (right to left and viceversa). At that time when the user is touching the header, I do not want the whole view to scroll as a normal listview dose when it has more items. Can some one guide me a solution for this? Check out the PlayStore app in your device for a clear understanding.
Thanks a bunch in advance. I would owe you a drink some day.
Why would you detect the gestures and implement the horizontal scrolling yourself, when there's a special control: HorizontalScrollView which already does this?
I don't know the internal details of Google Play app, but I would put the gallery of screenshots in a custom view, and this custom view to be wrapped in a HorizontalScrollView. Then add this custom view as a header to the ListView (basically how you begun).
As long as the scrolling directions are on different axis - the horizontal scrolling is done on X axis, and the vertical scroll on Y axis - there shouldn't be any problems in holding this.
Post Scriptum:
When you scroll the image screenshots horizontally in the Google Play app, I suppose there's a GalleryView instead of HorizontalScrollView, which can hold this type of transitions.

How to set a view to NOT scroll with scrollview in Java

is it possible to programmically force a View inside a ScrollView NOT to scroll?
Like the alphabetic titles in the contacts list. The 'A' bar doesn't scroll when the user scrolls through the list of all contacts whose first names start with 'A'. When the user scrolls till the end of 'A', 'B' bar simply scrolls up from the bottom of ScrollView, finally reaplacing 'A' at the top and staying there.
My description is kind of abstract, hope you understand.
Also thanks in advance.
The contacts list uses the ListView and not the ScrollView. One way I think it can be done is to have a fixed header at the top. You can change its content depending on what is being displayed on the screen.
Attach a OnScrollListener to ListView. You will get the view with the first visible position in onScroll. Then change the content of the header according to the content in the view.
You don't need to add a header in your ListView for the first section in your list as it will be already handled in your ScrollListener. Keep the style for the header rows and the view at the top the same and you will have the illusion for the fixed header.
I think you need a combination of the "static text" approach with "section headers" within the ScrollView: the list should contain disabled/non-clickable items with the letters "A", "B", etc. When a section header scrolls above the top of the view, change the contents of the static TextView above the ScrollView to the contents of the header. I.e., when the "B" header item scrolls out of view, the TextView now contains "B".
Of course, the tough part will be detecting when a "section header" scrolls off the top, or comes into view when scrolling in the opposite direction.
For bonus points, use a "push up" Animation in the TextView when it's contents change to make it look like the list item is rolling into the TextView. (There is an example of this Animation in the API Demos app in the SDK in "...\view\Animation2.java").
UPDATE: after further review... here is some classes, etc. related towards making this work (it was a fun exercise for me!):
android.widget.AbsListView.OnScrollListener interface to see how to detect scrolling events. You'll need to keep track of the previous "top of view" position to determine which direction you are scrolling (to pick the slide-up or -down animation).
The Animation I listed above is not really what you want -- better off to look at the android.widget.TextSwitcher class and the push*.xml files in the SDK/android-X/data/res/anim directory.
You'll certainly need your own adapter subclass to inject section views into the list: getView(...) can set the row view's properties (bkgnd, text style, etc.) differently if the row is a section header or not. Re-use this code in your TextSwitcher view factory to populate the static TextView/Switcher above the list.
Have fun...!
As mentioned earlier you need a ListView. For an effect similar to that in the People app in Android 4+ I have used this excellent library (free and open source).

Categories

Resources