Android RecyclerView循环水平滚动

时间:2017-10-07 18:07:36

标签: java android animation android-recyclerview

您好我在android中使用recyclerview,我希望在我的recyclerview中获得以下滚动效果imgcircularscroll

我该怎么做?我已经有水平滚动并同时显示三个项目,但如何使滚动像半圆一样如图所示?

这里是我片段的代码

//For RecyclerView
        recyclerView = (RecyclerView)view2.findViewById(R.id.recycler_view);
        //recyclerView.setNestedScrollingEnabled(false);

        mAdapter = new ShopsAdapter(shopList);
        //RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext(),LinearLayoutManager.HORIZONTAL, true);
       // mLayoutManager.setStackFromEnd(true);
        LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity().getApplicationContext(), LinearLayoutManager.HORIZONTAL, true);
        layoutManager.setReverseLayout(true);
        layoutManager.setStackFromEnd(true);

        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(mAdapter);

我的RowView for recyclerview

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    android:focusable="true"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:paddingTop="10dp"
    android:paddingBottom="10dp"
    android:clickable="true"

    android:orientation="vertical">
    <android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/cardview"

        android:layout_gravity="center"
        android:layout_width="100dp"
        android:layout_height="250dp"
        card_view:cardCornerRadius="4dp">

        <LinearLayout
            android:id="@+id/relativeLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
                    android:id="@+id/profile_image"
                    android:layout_width="120dp"
                    android:layout_height="120dp"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="10dp"
                    android:src="@drawable/user" />
            </RelativeLayout>

            <TextView
                android:id="@+id/id"
                android:layout_width="280dp"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:ellipsize="end"
                android:maxLines="1"
                android:paddingLeft="10dp"
                android:singleLine="true"
                android:text="Title"
                android:textColor="@color/title"
                android:textSize="16dp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/title"
                android:paddingLeft="10dp"
                android:text="Genre" />

            <TextView
                android:id="@+id/address"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingLeft="10dp"
                android:layout_alignParentRight="true"
                android:text="year"
                android:textColor="@color/year" />

        </LinearLayout>
    </android.support.v7.widget.CardView>




</LinearLayout>

,结果如下

whatihave for now

现在我只需要获得圆形滚动效果,请希望有人可以帮助我,谢谢你的进步。

0 个答案:

没有答案