I'm trying to handle the showing of the beginning and end of the list.
I cant to use a scroll event, but I want handle the next event. (try to scroll list view without more elements). How to handle showing of a footer/header?
I saw the field "private EdgeEffect mEdgeGlowTop" in the class "AbsListView". thats fine! but it is private field and I can't to set listener or override this field...
Your question doesn't seem to be that clear. But as I understood you want to add Header/Footer while scrolling the ListView. Here is an example for adding footer using Never Ending ListView
Related
Hi everyone.
I've come up with an idea for an Android App, and I was thinking how to turn my thoughts into something working. I know how to program for Android even though I'm not that advanced as you might see, so I wanted some tips from you guys who I'm sure will be able to help.
Idea
I was thinking about an App to organize stuff, see your objects on a list and be able to add, move or remove them from the list.
Thoughts
I first thought I needed a RecyclerViewto display each item. Then I thought every item itself might be a box, and so be containing other items inside: this brought me to think of a sort of "nested" system of RecyclerViews. Before going too deep into this system I had to clarify each item should have been a Class, each of which should have had a RecyclerView assigned.
Question
I was wondering how I could make this "nested" system of RecyclerViews. I thought about making a RecyclerView an object, because I need each RecyclerView to display, function and be always the same in any screen of any item. But I don't know what the best way is.
Should I make it an object? How do I create a new RecyclerView through a button so the user can first tap an item and then, eventually, tap a button (inside the item details view for instance) to make it a box item and so create and open a RecyclerView when tapped?
P.S.
It may seem like multiple questions but it actually is only one: how to add and display a RecycerView when I tap a button inside a details screen of an item, of course automatically (have a reference to that RecyclerView).
You have to create the RecyclerView that holds your items list, let's call it rv_list, this RecyclerView has an adapter that takes each item and adapts it to an xml layout row_item.xml that you should define. Now to make an item itself display its own recyclerview you should put a recyclerview inside row_item.xml and populate it when adapting that item to rv_list inside the method onBindViewHolder.
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.
Below is a picture of my app, I am currently using a modified version of this app to show my expandable content. Now my problem is with my ImageView, I currently have 3 layouts, one for the main dialog (with listview), one for the listview title & arrow and one for the item details (item row once expanded). I want to add animation to the ImageView so when you click the image or title textview, the list will expand and animate the change. How can I do this? I cannot get the onClick to work because it doesn't know there are 2 imageviews, it seens only one...
I will assume that your ImageView is this arrow inside your ListView element (because you didn't write it clearly enough).
You probably shouldnt try to attach onClickListener to your ImageView at all (nor to your ListView element title). The good way of implementing what you want you achieve would be to use ListView's onItemClickListener to detect clicks performed on specific items inside your listview, and then expanding appropriate expandable content.
I have a GridView which is scrollable: only some of the items will be displayed and only after scrolling down the GridView. We can see the other items. The problem is, I am setting the tags for all the items in the GridView, but by tracing the LogCat I came to know that it is not accepting to set the tags for the non-visible items in the GridView(I mean the items which are inside the grid, but at that time are not on the screen)
Before scrolling:
After scrolling:
Only after scrolling down the other items the tags are applied.
How can I set the tags for all the items of the grid, even if they are on the screen or off the screen?
Your problem is that you set the Tag in the getView method and this method is only called by the framework when the view need to be displayed.
Don't know exactly what you need to do with the view tag, but I think that instead of trying to get the data from a non-displayed view, you must get it from your ImageAdapter (ia.imageid[]).
EDIT:
To answer more preciselly to your question:
How can I set the tags for all the items of the grid, even if they are on the screen or off the screen?
As soon as the view doesn't always exists when it is not displayed: you cannot do it.
I suggest you to explain why you need those tags... may be you can use an alternative solution than view tag to accomplish your final needs.
Anyway, if you really need to have tag on view that aren't displayed yet:
Initialize a view array in onCreate method.
Populate this array with all your views (and set the tag)
modify getView method of your adapter to return the view from your array of view instead of creating the view.
Please note that I don't recommend this solution since it will consume more resources.
Finally myself i got the solution for my question.Thank you for all who gave their valuable suggestions.
Thank you #ben75
i checked the position of present clicked item and then applied the tag so if the user want to select the item which is presently not on the focus he has to scroll the grid and then have to select the item and then only the tag will be applied.
I tried to found a method, but no results. I want a ListView like below, and when I click on an element, like "Word", it'll be like this picture :
Is it possible ?
What you described is what an ExpandableListView does.
Basically it's like a listview so you'll still have to create your own adapter, but it lets you click a row to inflate a bigger item that you can then stuff your text into.
I would recommend creating your own class that extends ArrayAdapter or BaseAdapter. Then you can make use of the getView() method that gets called every time the screen gets redrawn for the user. You can then design multiple views for each selection and choose which one to display in the getView() function. So when the user selects an item, you set a flag in your custom class, and then notifyDataSetChanged() and you're good to go!