Android skeleton screen, support separate View, RecyclerView, ListView, GridView, ViewPager. More uniform API than other frameworks, and memory optimization.

rendering

The View effect

RecyclerView effect

Effect of ListView

ViewPager effect

Gradle reference

Dependencies {implementation 'IO. Making. Wslaimin: piccolo: 1.0.0'}Copy the code

use

PiccoloLayout tag View

<com.lm.piccolo.view.PiccoloLayout
    android:id="@+id/Piccolo_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="60dp"
    app:mask="com.lm.piccolo.drawable.ImageShiningDrawable">

    <ImageView
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:src="@drawable/ic_launcher_background"/>
</com.lm.piccolo.view.PiccoloLayout>
Copy the code

PiccoloLayout supports:

App: Mask supports drawable, color, and custom drawable

App: Shining property Skeleton map whether to enable animation

App :shining_paddingLeft Property map distance from skeleton to View left

App :shining_paddingRight Property Skeleton map distance To the right of View

App :shining_paddingTop Property Skeleton map Distance View top distance

App :shining_paddingBottom Property Skeleton distance Bottom distance of View

Used alone

PiccoloLayout piccoloImage=findViewById(R.id.Piccolo_image);
ConductorForView conductor=Piccolo.createForView(piccoloImage).visible(true);
conductor.play();
Copy the code

ConductorForView provides the following methods:

Mask (Drawable mask) Set skeleton drawing Drawable object shining(Boolean shining) Whether skeleton drawing is animated paddingLeft(int padding) The distance from skeleton to View left paddingTop(int PaddingRight (int paddingBottom) paddingBottom(int paddingBottom) Visible (Boolean Play () applies the above method to set the propertiesCopy the code

Used in Adapter

RecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
ConductorForAdapter ConductorForAdapter = Piccolo.createForList(recyclerView);
int[] data=new int[]{R.layout.item, R.layout.item_another, R.layout.item, R.layout.item_another, R.layout.item, R.layout.item_another, R.layout.item, R.layout.item_another};
ConductorForAdapter.items(data)
              	.visible(true)
                .adapter(new Adapter())
                .play();
Copy the code

ConductorForAdapter provides the following methods:

Items (ViewSpec[] items) Skeleton View Configuration items(int[] items) skeleton View id adapter(recyclerView. adapter <? > adapter) When the skeleton is not visible, RecyclerView adapter adapter(PagerAdapter) When the skeleton is not visible, ViewPager adapter adapter(BaseAdapter) Adapter Visible (Boolean Visible) Play () applies the above method to set the propertiesCopy the code

Support RecyclerView, ListView, GridView, ViewPager.

Making the address

piccolo

Communication

Wait for you to come to Android bubble group bubble oh!

QQ: 905487701