Change the margin of first visible item in recyclerview


greggerz
7/5/2016 5:43 am
HOME ยป Web Development

How to change the margin (bottom with 20 dp) of first complete visible item on horizontal recycleview with cards? I can get only the index of first complete visible item but not any reference to the view.

`mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy);

           firstVisibleItem =
lm.findFirstCompletelyVisibleItemPosition();
        View view=  mRecyclerView.getChildAt(firstVisibleItem);

        RelativeLayout.LayoutParams lp= new
RelativeLayout.LayoutParams(300, 150);
        lp.setMargins(0, 0, 0, 20);
        view.setLayoutParams(lp);

       }
    });

Related to : Change the margin of first visible item in recyclerview
Change the margin of first visible item in recyclerview
7/5/2016 5:43 am by greggerz in Web Development

How to change the margin (bottom with 20 dp) of first complete visible item on horizontal recycleview with cards? I can get only the index of first complete visible item but not any reference to the view.

`mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {


Add a new item to recyclerview programatically?
8/1/2015 4:40 pm by zclin in Web Development

I'm still trying to get my head around recyclerview. I have an arraylist, that I use to initialize a recycler view with.

How can I add new items to the recycler view post setting an adapter and layoutmanager?

private void initData() {
        mItems = new ArrayList<Str
menu item not visible when i change the language dynamically
by patrickcarver in Web Development
Hi all,
i have a strange problem.i am trying to change the application language dynamically and get some success in it.
now the problem appears is that as soon as i change the language dynamically the applications menu option get invisible.they appears only when i click al1 or r1 button. TAGS: menu item visible when change language
RecyclerView Animation on Item Click
31/12/2014 7:10 am by DCal430 in Web Development

I am trying to implement my own recyclerview Animation - I would like to achieve this without using any external libraries. Here is what the theoretical animation should look like.

enter image
description here

The user


Implement Swipe Gesture on a RecyclerView Item?
14/11/2014 1:10 am by Kbotei in Web Development

I have seen nice solutions to implement onClick and onLongClick gesture in OnItemTouchListener. What I am looking for now is the code to implement a Swipe Gesture in OnItemTouchListener.

If you have any idea or if you came across a blog or a tutorial , please let me know.Thanks.


How to click on an item inside a RecyclerView in Espresso
15/12/2014 8:30 am by DaveStall in Web Development

I have a RecyclerView (R.id.recyclerView) where each row has an image (R.id.row_image) and a textview. I want to click on the image. I want to click on the image in the first row.
I've tried to use onData(..) but it doesn't seem to work.


Android Robolectric Click RecyclerView Item
21/11/2014 1:50 am by ArmHead in Web Development

Is there any way to simulate a click on a RecyclerView item with Robolectric?

So far, I have tried getting the View at the first visible position of the RecyclerView, but that is always null. It's getChildCount() keeps retu


RecyclerView scrollbar jumps back to top after first item
20/11/2014 1:20 pm by Marc Dong in Web Development

I created a very basic RecyclerView example.

Layout:

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools
RecyclerView with StaggeredGrid, Wrong Item Position
17/11/2014 10:30 pm by overst33r in Web Development

When I load data with images, some item positions are wrong. However, when I scroll this view, these images are positioned correctly.

Examples:

First Load http://i.stack.imgur.com/3MClp.jpg

Scro


How to properly highlight selected item on RecyclerView?
2/12/2014 2:20 am by Brian in Web Development

I am trying to use RecyclerView as horizontal listview. I am trying to figure out how to highlight selected item. When i click one of the item, it gets selected and it is highlited properly but when i click another one second one gets highlighted with the older one.

Here is my onClick fu


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .