Commit 9d07eb7d6d0ea4986e95e53163ff3980956b9a4b
1 parent
f552dcac
Exists in
yxb_dev
and in
2 other branches
no message
Showing
2 changed files
with
16 additions
and
4 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
... | ... | @@ -25,6 +25,7 @@ import com.shunzhi.parent.bean.GrallyBean; |
25 | 25 | import com.shunzhi.parent.bean.MyConsultBean; |
26 | 26 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; |
27 | 27 | import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter; |
28 | + | |
28 | 29 | import java.util.ArrayList; |
29 | 30 | import java.util.List; |
30 | 31 | |
... | ... | @@ -42,7 +43,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
42 | 43 | |
43 | 44 | LinearLayout layout_control; |
44 | 45 | |
45 | - List<MyConsultBean> myConsultBeanList=null; | |
46 | + List<MyConsultBean> myConsultBeanList = null; | |
46 | 47 | |
47 | 48 | @Override |
48 | 49 | public int getLayoutId() { |
... | ... | @@ -66,7 +67,17 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
66 | 67 | if (null == myGrallyAdapter) myGrallyAdapter = new MyGrallyAdapter(); |
67 | 68 | myGrallyAdapter.addAll(grallyBeanList); |
68 | 69 | recyclerViewGrally.setAdapter(myGrallyAdapter); |
70 | + recyclerViewGrally.addOnScrollListener(new RecyclerView.OnScrollListener() { | |
71 | + @Override | |
72 | + public void onScrollStateChanged(RecyclerView recyclerView, int newState) { | |
73 | + super.onScrollStateChanged(recyclerView, newState); | |
74 | + } | |
69 | 75 | |
76 | + @Override | |
77 | + public void onScrolled(RecyclerView recyclerView, int dx, int dy) { | |
78 | + super.onScrolled(recyclerView, dx, dy); | |
79 | + } | |
80 | + }); | |
70 | 81 | |
71 | 82 | } |
72 | 83 | |
... | ... | @@ -85,7 +96,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
85 | 96 | |
86 | 97 | private void initRecyclerViewConsult() { |
87 | 98 | if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity()); |
88 | - if (null==myConsultBeanList)myConsultBeanList=new ArrayList<>(); | |
99 | + if (null == myConsultBeanList) myConsultBeanList = new ArrayList<>(); | |
89 | 100 | else myConsultBeanList.clear(); |
90 | 101 | for (int i = 0; i < 12; i++) { |
91 | 102 | MyConsultBean myConsultBean = new MyConsultBean(); |
... | ... | @@ -144,7 +155,8 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
144 | 155 | tv_grally_title = itemView.findViewById(R.id.tv_grally_title); |
145 | 156 | frame_root = itemView.findViewById(R.id.frame_root); |
146 | 157 | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-1, -1); |
147 | - params.width = DisplayUtils.getScreenWidthPixels(getActivity()) - 40; | |
158 | + params.width = DisplayUtils.getScreenWidthPixels(getActivity()) - 100; | |
159 | + params.setMargins(10, 0, 10, 0); | |
148 | 160 | frame_root.setLayoutParams(params); |
149 | 161 | } |
150 | 162 | ... | ... |
app/src/main/res/layout/item_grally.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | - android:layout_width="match_parent" | |
3 | + android:layout_width="wrap_content" | |
4 | 4 | android:layout_height="match_parent" |
5 | 5 | android:layout_margin="@dimen/size_dp_10" |
6 | 6 | android:id="@+id/frame_root" | ... | ... |