Преглед изворни кода

修复界面问题:主页滑动任务到最下面后,tab覆盖在搜索框上

zengjiebin пре 7 година
родитељ
комит
8fc19f2eb6

+ 32 - 38
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -691,16 +691,14 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
     @SuppressLint("ClickableViewAccessibility")
     public void initListener() {
-        scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
-            @Override
-            public void onScrollChange(NestedScrollView nestedScrollView, int x, int y, int oldX, int oldY) {
-                listTitle.getLocationInWindow(locate);
-                if (locate[1] < 0 && titleCardLayout.getVisibility() == View.GONE) {
-                    ViewUtil.setVisibility(titleCardLayout, true);
-                } else if (locate[1] > 20 && titleCardLayout.getVisibility() == View.VISIBLE) {
-                    ViewUtil.setVisibility(titleCardLayout, false);
-                }
-                //设置搜索框颜色变化
+        scrollView.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (nestedScrollView, x, y, oldX, oldY) -> {
+            listTitle.getLocationInWindow(locate);
+            if (locate[1] < 0 && titleCardLayout.getVisibility() == View.GONE) {
+                ViewUtil.setVisibility(titleCardLayout, true);
+            } else if (locate[1] > 20 && titleCardLayout.getVisibility() == View.VISIBLE) {
+                ViewUtil.setVisibility(titleCardLayout, false);
+            }
+            //设置搜索框颜色变化
 //                float ratio = Math.min(bannerHeight, y) * 1.0f / bannerHeight;
 //                to_search_but_rl.setBackgroundColor(Color.argb((int) (ratio * 255), 255, 255, 255));
 //                float colorRatio = 1 - ratio * 0.26f;
@@ -720,36 +718,32 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 //                    }
 //                }
 //                LogUtil.println("FgtSmallSheep", "onScrollChange", x, y, oldX, oldY, locate[0], locate[1]);
-            }
         });
-        scrollView.setOnTouchListener(new View.OnTouchListener() {
-            @Override
-            public boolean onTouch(View v, MotionEvent event) {
-                switch (event.getAction()) {
-                    case MotionEvent.ACTION_DOWN:
-                        if (upview1 != null) {
-                            //开始滚动
-                            upview1.stopFlipping();
-                        }
-                        if (homepageItemNoticeMv != null) {
-                            //开始滚动
-                            homepageItemNoticeMv.stopFlipping();
-                        }
-                        break;
-                    case MotionEvent.ACTION_UP:
-                    default:
-                        if (upview1 != null) {
-                            //开始滚动
-                            upview1.startFlipping();
-                        }
-                        if (homepageItemNoticeMv != null) {
-                            //开始滚动
-                            homepageItemNoticeMv.startFlipping();
-                        }
-                        break;
-                }
-                return false;
+        scrollView.setOnTouchListener((v, event) -> {
+            switch (event.getAction()) {
+                case MotionEvent.ACTION_DOWN:
+                    if (upview1 != null) {
+                        //开始滚动
+                        upview1.stopFlipping();
+                    }
+                    if (homepageItemNoticeMv != null) {
+                        //开始滚动
+                        homepageItemNoticeMv.stopFlipping();
+                    }
+                    break;
+                case MotionEvent.ACTION_UP:
+                default:
+                    if (upview1 != null) {
+                        //开始滚动
+                        upview1.startFlipping();
+                    }
+                    if (homepageItemNoticeMv != null) {
+                        //开始滚动
+                        homepageItemNoticeMv.startFlipping();
+                    }
+                    break;
             }
+            return false;
         });
 
         refresh.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {

+ 3 - 1
app/src/main/res/layout/homepage_act_layout.xml

@@ -174,6 +174,8 @@
 
     <include
         layout="@layout/view_float_title_card"
-        android:visibility="visible" />
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/to_search_but_rl"/>
 
 </RelativeLayout>

+ 0 - 1
app/src/main/res/layout/view_float_title_card.xml

@@ -10,7 +10,6 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:layout_marginTop="44dp"
         android:background="@color/white"
         android:paddingBottom="10dp">