Expand animation of a row in ListView - java

I have a ListView with restaurants. Each row has an expand button which lets you see the restaurant's menu. I'm trying to add a smooth expand animation. So far I've got something like this:
TranslateAnimation expandAnimation = new TranslateAnimation(0f, 0f, -targetHeight, 0f)
expandAnimation.setDuration(300)
menuLayout.startAnimation(expandAnimation)
It is smooother than actually changing height with something like ValueAnimator (which is what I tried before).
My problem is that this animates only the row whose menu is expanding. I would like to animate also the visible rows below the row with expanding menu to achieve better visual effect. I tried to get them from the ListView with ListView.getChildAt() and apply similar TranslateAnimation on them but this doesn't work if the menu is too long. I believe this happens due to the View being recycled by my ListView so is there any workaround?

Look at this Library, as per your explanation this will work perfectly
https://github.com/h6ah4i/android-advancedrecyclerview
dependencies {
implementation ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0#aar'){
transitive=true
}
}

Related

Android Studio: ListView OnClick animation doesn't work if you set background color of items

In my project I've setted the background color of my items (composed of several elements inserted in a ConstraintLayout) inside a ListView but the default animation of click and long click disappears if the background color is not at least a little transparent. In fact, as transparency decreases, the effect of clicking on the elements is less and less evident. In a few words, color goes to hide the animation if isn't transparent. How to solve this problem and then bring selection animation to the foreground?
Same problem, still unresolved: ListView items not showing tap animation
RESOLVED!
You have to simply add android:drawSelectorOnTop="true" in your ListView XML tag. In this way you can modify and customize the list item background and at the same time bring back the "selector" on top of the "z axis" of GUI. Yuhu!
If you are giving a background coloraturas to the list items then you might be hiding the system press animations. in this case you can use the methods like OnItemLongClickListener() and itemClickListener () and add your custom animations to the view.

Up and Down buttons for ListView instead of scrollpanel

I'm new to javaFX. and I have a question about navigation in ListView, instead of using scrolling bar in the listview for moving up and down, I want to have separated Up and Down buttons for it. But I don't know how to do it, I see somethings with ScaleX and ScaleY but honestly they are not very clear to me.
Can someone help me? What parameters of the listview should be changed when the up or down button is click ?
Thank you very much. I'm using javaFX 8.
There are different options.
You can use the scrollTo-Method of the listView. There you could use the index and just call the Method with an incremented or decremented one.
You can get the scrollbar like this
ScrollBar bar = (ScrollBar) yourListView.lookupAll(".scroll-bar");
and call the setValue-Method to move it with the Buttons.

JavaFX ListView - Scroll with button press

I have a listView that contains my data, but instead of scrolling using the scroll bar, i need to be able to press a button to scroll up (if the listview can scroll up) and a button to scroll down (if the listview can scroll down)
Anyone know how i would go about this? I have checked the listView, and there seems to be no function to scroll up or down.
Ideally i would like to know if there are properties against a listView that tell me the
Maximum Y position that the listView can go to
Current Y postition that the listView is scrolled to
Using these values i can code the rest.
In the end, i removed the listView, and used a ScrollPane with a VBox. Then i added my items to the VBox instead. I had to make changes to the items i was adding to the listView originally, but this seems to work nicely.
I can now use the get/set property VMin, VMax and Vvalue on the scrollPane.
There is Flowless which acts as a simplified(*) (and more efficient) ListView. It has scrollX(dx) and scrollY(dy) methods that you can use to scroll the content.
(*) It does not support selection and inline editing out of the box, but can be implemented on top of it.

Android Horizontal Scrolling that Snaps to List Items

I'd like to implement a UI experience in Android where a user can view a single item (for example, an item in my case is a collection of texts), and swipe left or right on the item to go to the previous or next item.
From my research, ListView does not implement horizontal scrolling. Potential candidates seem to be HorizontalScrollView and GridView, but I haven't seen any examples that can do this simply - only seemingly complicated libraries that need to be included.
My question is, is there a way to use ListView, HorizontalScrollView, GridView, or a combination of them to implement a horizontal scroll that shows one item at a time and snaps to the item being displayed?
The highlighted area in the picture below shows where I'm trying to implement this logic.
It looks like the best option to achieve this experience is a ViewPager, which requires the android support library.
http://developer.android.com/reference/android/support/v4/view/ViewPager.html

Android: i need to do a menu like the image

i'm developing an application for android that is already done for IOS, is not big problem.
the thing is that my boss want it to be exactly the same, but one of the menus is the problem, is like a slide menu but with zoom and a background image, anyone have any idea how can i do this, i already google it but no results :(, a library would help.
here is a picture with the menu for IOS.
I don't think if it would be an effective solution but you can use a RelativeLayout.
Put the selection part behind in a LinearLayout then put a framelayout front to contain list fragments. This way you shouldn't use an action bar to have absolutely same looking with iOs version.
When someone clicks open button apply an animation to your framelayout. scale it by %75 and move it 25% in y coordinate and move it %50 in x coordinate. When buttons in your LinearLayout apply a reverse animation to your FrameLayout. If swap button clicked change your fragment with new one. You can also aply a transaction animation to your fragments.
I hope you know how to handle this stuff. If no I can do my best to code an example.
EDIT:
Don't forget to set your flame layout unclickable when you move it to right side.
https://github.com/SpecialCyCi/AndroidResideMenu
I think I found your answer. I came across this in a list of libraries it is 3.8 on the list https://github.com/Trinea/android-open-project/tree/master/English%20Version
Cheers!

Categories

Resources