LinearLayoutManager.java
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.cnlive.strike.util;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
/**
* Created by xiansong on 2018/2/7.
*/
public class LinearLayoutManager extends android.support.v7.widget.LinearLayoutManager {
public LinearLayoutManager(Context context) {
super(context);
init();
}
public LinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
init();
}
public LinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
private void init() {
setAutoMeasureEnabled(true);
}
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
}