LayoutManager+ItemTouchHelper five lines of code to achieve dazzling sliding card stacking layout, simple & elegant interface like Tantan and Renren video subscription:

List of effects:

Imitation Tantan, Renren film and television card stacking dazzling sliding layout

The sense of sight when the emperor flips the brand

The sense of sight when the emperor flips the brand

Renrenmei Drama Subscription Interface

Renrenmei Drama Subscription Interface

Configurable parameters (6 pages displayed simultaneously):

Renrenmei Drama Subscription Interface

Flow layout

write picture description here

Emma, ​​it looks a lot better after replacing it with a girl picture. I don't even know it anymore. Well, it usually looks like this in the project:

write picture description here

Usually this effect, we generally use a custom ViewGroup to achieve, I also wrote one before. Customize VG to achieve flow layout

use:

Step 1. Add the JitPack repository dependency in the project root build.gradle file.

    allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }

Step 2. Add the dependency

    dependencies {
            compile 'com.github.mcxtzhang:ZLayoutManager:V1.1.0'
    }

Step 3.  Imitation Tantan, Renren video card stacking dazzling sliding layout :

After the boss asks you to do this effect, you only need to:

    mRv.setLayoutManager(new OverLayCardLayoutManager());
        CardConfig.initConfig(this);
        ItemTouchHelper.Callback callback = new RenRenCallback(mRv, mAdapter, mDatas);
        ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
        itemTouchHelper.attachToRecyclerView(mRv);

If you need to customize special parameters, such as display 6 layers:

         CardConfig.MAX_SHOW_COUNT = 6;

Set Imitation Tantan to slide up and down vertically without deleting items.

Horizontal direction judgment error threshold x:

        final TanTanCallback callback = new TanTanCallback(mRv, mAdapter, mDatas);
        callback.setHorizontalDeviation(x);

Flow layout :

        mRv.setLayoutManager(new FlowLayoutManager());

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324588321&siteId=291194637