BelooS / ChipsLayoutManager

ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features
Apache License 2.0
3.25k stars 362 forks source link

Support initialization throw XML app:layoutManager attribute #32

Open danielesegato opened 7 years ago

danielesegato commented 7 years ago

Hi,

Can you support the initialization through XML?

Ideally I would like to be able to do something like this:

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layoutManager="com.beloo.widget.chipslayoutmanager.ChipsLayoutManager"
    app:chipsLM_scrollingEnabled="true"
    app:chipsLM_maxViewsInRow="2"
    app:chipsLM_gravityResolver="full.class.name.Here"
    app:chipsLM_rowBreaker="full.class.name.Here"
    app:chipsLM_orientation="horizontal"
    app:chipsLM_rowStrategy="fillSpace"
    app:chipsLM_rowStrategyOnLastRole="false"
    tools:listitem="@layout/item_layout"/>

This should only require implementing a standard constructor (never tried tough):

public ChipsLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ChipsLayoutManager, defStyleAttr, defStyleRes);
    // read attributes here
    a.recycle();
}

I can work on this myself if you are willing to accept contributions.

gasry1989 commented 7 years ago

have you ever added pull up to refresh, pull down to load more for chipslayout?? or do something about it.