ChipsLayoutManager icon indicating copy to clipboard operation
ChipsLayoutManager copied to clipboard

Support initialization throw XML app:layoutManager attribute

Open danielesegato opened this issue 8 years ago • 1 comments

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.

danielesegato avatar Mar 11 '17 15:03 danielesegato

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

gasry1989 avatar Jun 07 '17 23:06 gasry1989