android-recyclerview

Visibility of expanding last view in the expandable RecyclerView

送分小仙女□ 提交于 2019-12-06 11:38:06
I want the things in the last expandable item to be fully visible when it is clicked,Now what is happening means when I click on last item it expands down, but I manually need to scroll up again to see the the things inside the expanded item.How can the last expandable item be fully visible. I am using Recyclerview. Vineeth Holla I have found the solution which I wanted, I used recyclerView.smoothScrollToPosition(selectedPosition); after setting the adapter. So now the things in the last expandable item is fully visible when it is clicked. Just a supplementary: If you use h6ah4i

Custom RecyclerAdapter and startActivityForResult

走远了吗. 提交于 2019-12-06 11:18:17
I have a Fragment that contains a RecyclerView which uses a custom RecyclerAdapter . I have an onClickListener inside my custom RecyclerAdapter - when a position is clicked I want it to start startActivityForResult . So far this works in as such as when it is clicked it starts the Activity as desired. However when I press the back button to go to the Fragment containing the RecyclerView onActivityResult is never called. I have passed in a context to the custom RecyclerAdapter . Is this something that is possible? Or does the Activity/Fragment initiating startActivityForResult be the one that

Implementing Endless RecyclerView

三世轮回 提交于 2019-12-06 11:14:24
问题 I want to implement an endless RecyclerView but so far all the implementations and tutorials I have come across describe loading data off a server then loading it or dynamically adding elements using a loop. In my case, I already have a large ArrayList containing the data I want to display in the RecyclerView. What I need is to say, display the first 10 items of the array, and on loading more, display the next batch of 10. 回答1: This could achieve your goal. public abstract class

RecyclerView does not load data from Firebase on first launch

房东的猫 提交于 2019-12-06 11:14:17
问题 I am getting data from Firebase but RecyclerView is not showing that data on first launch. It displays the data when I open the activity again. In my main activity- databaseReference = FirebaseDatabase.getInstance().getReference("data").child("childdata"); recyclerView = (RecyclerView)findViewById(R.id.recyclerviews); recyclerView.setHasFixedSize(true); recyclerAdapter = new DisplayRecyclerAdapter(list,this); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView

RecyclerView - how can I get a reference to each row's View

空扰寡人 提交于 2019-12-06 11:10:53
问题 I'm using the new RecyclerView to replace my existing ListViews and ran into the following problem: in the old BaseAdapter , I could create a "fly-in" Animation for each item inside the adapter by simply applying this Animation to the convertView and noticing in a SparseBooleanArray for which position the Animation was already shown. The onBindViewHolder() method which has replaced getView() doesn't provide access to any Views , nor does the new ItemAnimator . Basically I would need to access

StaggeredGridLayoutManager dislocation

China☆狼群 提交于 2019-12-06 10:57:45
I have used RecyclerView and StaggeredGridLayoutManager. When I scroll from top to the bottom, it looked well. But when I scroll from bottom to the top , the top child view appear a blank. Now, I found when I scroll from top to bottom, it looks : left1 right1 left2 right2 left3 right3 left4 right4 left5 right5 left6 right6 left7 right7 When I scroll from bottom to the top, something happened, it looks like this: right1 left1 right2 left2 right3 left3 right4 left4 left5 right5 left6 right6 left7 right7 and the height of left and right is different, so when on the top , it appeared a blank. Here

RecyclerView LinearLayoutManager.scrollToPositionWithOffset dose not work

人走茶凉 提交于 2019-12-06 10:50:33
问题 I want to scroll the RecyclerView to a position, and I use LinearLayoutManager.scrollToPositionWithOffset() to scroll, but it does not work. Could any one help me? My code: init the RecyclerView : mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); and in the Button onClick , I do this to scroll the View : ((LinearLayoutManager)mRecyclerView.getLayoutManager()).scrollToPositionWithOffset(position, offset); 回答1: I

Recyclerview list end overlay color and alpha

佐手、 提交于 2019-12-06 10:49:31
How can I change the grey or white overlay that comes on recyclerview when we try to scroll even when we reached the end(top or bottom) of list. I am not able to find the property name to which I can use to do it. The RecyclerView take the shadow from the colorPrimary of your Theme. You need to create new theme for RecyclerView then apply this Theme to your RecyclerView In below example themes colorPrimary is colorGreen so it will take green color shadow. SAMPLE CODE <android.support.v7.widget.RecyclerView android:id="@+id/ha_citiesRC" android:layout_width="match_parent" android:layout_height=

OnCreateViewHolder is still called even if ItemAnimator.canReuseUpdatedViewHolder() returns true

无人久伴 提交于 2019-12-06 10:42:47
问题 I'm building a change animation for my RecyclerView. I've overriden canReuseUpdatedViewHolder() to return true in order to retain the previous viewholder. I start the animation in animateChange() and call dispatchAnimationFinished() as soon as it ends. Params oldHolder and newHolder are the same instance in animateChange() . Then, as soon as the animation starts, RecyclerView's onBindViewHolder() is called for every child in the list. Surprisingly, only for the animated item a new ViewHolder

Get height for RecyclerView child views at runtime

匆匆过客 提交于 2019-12-06 10:06:44
问题 I'm trying to make an expandable TextView that expands/collapses when a user presses a button. The TextView and ImageButton are in a CardView, which is added to a RecyclerView. The expand/collapse work nicely, but now I want to add the ImageButton only when the TextView height exceeds a certain maximum height. But when I evaluate the height in the LayoutManager's addView method, it returns 0, probably because the TextView does not have any text yet. Is there any callback method that I can