TonicArtos / SuperSLiM

A layout manager for the RecyclerView with interchangeable linear, grid, and staggered displays of views, all with configurable section headers including the sticky variety as specified in the material design docs.
http://tonicartos.nz
2.12k stars 296 forks source link

How to change left margin of list items in demo #140

Closed mobiRic closed 9 years ago

mobiRic commented 9 years ago

I've been working through the demo and still can't figure out where the margin of the main items gets set. More specifically, the text_line_item.xml is inflated and has an offset applied to it - I want to change that offset.

I have modified the example to use LinearSLM instead of the grid:

public void onBindViewHolder(CountryViewHolder holder, int position) {
    final LineItem item = mItems.get(position);
    final View itemView = holder.itemView;

    holder.bindItem(item.text);

    final LayoutManager.LayoutParams lp = LayoutManager.LayoutParams.from(itemView.getLayoutParams());
    lp.setSlm(LinearSLM.ID);
    lp.setFirstPosition(item.sectionFirstPosition);
    itemView.setLayoutParams(lp);
}

Thx

mobiRic commented 9 years ago

Closing: I found the property app:slm_section_headerMarginStart in header_item.xml.