Up and Down buttons for ListView instead of scrollpanel - java

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.

Related

Expand animation of a row in ListView

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
}
}

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: 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!

Listview items show they've been clicked when they haven't

Hey so i've got a listview with buttons on it, when one is clicked if you skip down 4 more listview items the fifth shows it's been clicked in the same place the previous one was clicked. When a button is clicked it is set to invisible and the dummy button underneath is shown (which is the one that shows up in every fifth row).
Code that declares button invisible in the onclick command
boolean processClick=true;
if(processClick == true)
{
myButton.setEnabled(false);
myButton.setClickable(false);
myButton.setVisibility(View.INVISIBLE);
}
processClick=false;
}
After looking at some similar questions, I think this has to do with the views being recycled, but still not sure how to remedy this.
Any helps at all is much appreciated.
Thanks!
Yes u are having problem with your code,you need to take processClick for each listView row/item and then on that bases u need to set enabled(false) or something else.You can take reference from this example which is similar work but with checkbox. You need to look at that code and apply with button. It'll solve your problem.
link of sample ex. https://drive.google.com/file/d/0B6C9Pqrvc_CWZHFDcmxKR01rc3c/edit?usp=sharing
I faced a similar problem when I was programatically assigning background color to my listview items. I dont know what caused the problem (probably the getView() was not getting called properly). I solved my problem by using if-else. In your case something like this should work:
if(processClick == true)
{//set desired result in if
myButton.setEnabled(false);
myButton.setClickable(false);
myButton.setVisibility(View.INVISIBLE);
}else{//reset items to original in else
myButton.setEnabled(true);
myButton.setClickable(true);
myButton.setVisibility(View.GONE);
}

How to create buttons like Android Google Plus App

I am new to Android development, and I am wondering if there are any samples available to create a panel similar to the photo/checkin/mood/write panel at the bottom of the google+ app on android.
1) Are they 4 buttons? How do I style the buttons to look like that?
2) I want to auto hide the panel on scroll down, but show on scroll up.
Appreciate if anyone could guide me in the right direction.
Cheers
To show\hide panel - use animation.
This panel can be linearLayout with 4 buttons.
Do detect what've been scrolled look at: Synchronise ScrollView scroll positions - android
you can use linearlayout and in that take for imageview..when scrolling you can show/hide linearlayout..and for view you can use linearlayout color as black and this imageview images..
OK, so I implemented exactly what you trying to do only without the buttons.
After lot of hours spending googling around I found this one - https://gist.github.com/imminent/4576886 by Dandre' Allison, which is a specific implantation of quick return bar for a list view which is little more trickier from other view components. For more implementations of quick return bar and other scrolling tricks you can use Roman Nurik's Scrolling Tricks library here https://plus.google.com/u/0/+RomanNurik/posts/1Sb549FvpJt and here http://www.androidviews.net/2012/11/scrolling-tricks/. I just saw that there is another quick return bar for list view implenation by Lars Werkman in https://github.com/LarsWerkman/QuickReturnListView which I never tested. I used the Dandre' Allison snippet which works great.
Answering your first question.
all the buttons are either in ImageButton, or in ImageView that make it clickable. it's either you can lay it out in LinearLayout or RelativeLayout, well it's depends on how you want to make it.
Try Using split action bar this will basically do the task for you.

Categories

Resources