詹子聪 5 лет назад
Родитель
Сommit
9829746e8d

+ 9 - 0
app/src/main/java/com/itant/shibei/ui/home/GoodsFragment.java

@@ -25,6 +25,7 @@ import java.util.List;
  * Description: 商品列表Fragment
  */
 public class GoodsFragment extends BaseMVPFragment implements IGoodsView {
+    private static final int PAGE_START = 0;
 
     @InjectPresenter
     GoodsPresenter mPresenter;
@@ -33,6 +34,9 @@ public class GoodsFragment extends BaseMVPFragment implements IGoodsView {
     private RecyclerView rv_goods;
     private List<GoodsBean> mGoodsList = new ArrayList<>();
 
+    /**当前页*/
+    private int mCurrentPage = PAGE_START;
+
     private ImageView iv_empty;
 
     @Override
@@ -66,6 +70,11 @@ public class GoodsFragment extends BaseMVPFragment implements IGoodsView {
         mGoodsList.clear();
         mGoodsList.addAll(goodsList);
         mAdapter.notifyDataSetChanged();
+        if (mCurrentPage == PAGE_START) {
+            // 如果是第0页数据,要与顶部对齐
+            // 或者用这个mLayoutManager.scrollToPositionWithOffset(0, 0);
+            rv_goods.smoothScrollToPosition(0);
+        }
         if (mGoodsList.size() == 0) {
             iv_empty.setVisibility(View.VISIBLE);
         } else {

+ 12 - 13
app/src/main/res/layout/activity_tab.xml

@@ -3,13 +3,13 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/colorPrimary"
     android:fitsSystemWindows="true">
 
     <com.google.android.material.appbar.AppBarLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:id="@+id/abl_main">
+        android:id="@+id/abl_main"
+        android:background="@color/white">
         <!--android:theme="@style/AppTheme.AppBarOverlay"-->
 
         <!--android:minHeight="?actionBarSize"水波纹居中和gravity属性有关-->
@@ -19,8 +19,8 @@
             android:paddingStart="@dimen/margin_default"
             android:orientation="horizontal"
             app:layout_scrollFlags="scroll|enterAlways|snap"
-            android:gravity="center_vertical"
-            android:paddingTop="@dimen/margin_default">
+            android:paddingTop="@dimen/margin_default"
+            android:gravity="center_vertical">
             <ImageView
                 android:layout_width="@dimen/size_icon_big"
                 android:layout_height="@dimen/size_icon_big"
@@ -33,19 +33,17 @@
                 android:id="@+id/title"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:gravity="center"
-                android:text="拾贝 · 让您购物少花费"
+                android:text="拾贝 · 安心购物少花费"
                 android:textStyle="bold"
-                android:layout_gravity="center_vertical"
                 android:textColor="@color/black_theme"
-                android:textSize="@dimen/size_title" />
+                android:textSize="@dimen/size_hello" />
 
             <Space
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"/>
 
-
+            <!--上方搜索-->
             <FrameLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content">
@@ -86,10 +84,10 @@
                 </RelativeLayout>
             </FrameLayout>
 
+            <!--更多-->
             <RelativeLayout
                 android:layout_width="@dimen/height_edit_text"
                 android:layout_height="@dimen/height_sliding_tab">
-                <!--无边界波纹-->
                 <FrameLayout
                     android:id="@+id/fl_more"
                     android:layout_width="wrap_content"
@@ -111,7 +109,7 @@
             android:layout_height="wrap_content"
             android:orientation="horizontal"
             android:gravity="center_vertical"
-            android:background="@color/colorPrimary">
+            android:background="@color/white">
 
             <com.flyco.tablayout.SlidingTabLayout
                 android:id="@+id/stl_home"
@@ -121,8 +119,8 @@
                 android:layout_gravity="center_horizontal"
                 app:tl_iconVisible="false"
                 app:tl_indicator_bounce_enable="false"
-                app:tl_indicator_color="@color/black"
-                app:tl_indicator_height="3dp"
+                app:tl_indicator_color="@color/black_theme"
+                app:tl_indicator_height="2.5dp"
                 app:tl_indicator_width="10dp"
                 app:tl_tab_width="44dp"
                 app:tl_textBold="NONE"
@@ -133,6 +131,7 @@
                 android:layout_marginStart="@dimen/margin_s"
                 android:layout_marginEnd="@dimen/margin_default"/>
 
+            <!--搜索-->
             <RelativeLayout
                 android:id="@+id/rl_search"
                 android:layout_width="@dimen/height_edit_text"

+ 10 - 8
app/src/main/res/layout/fragment_about.xml

@@ -53,27 +53,29 @@
 
     <TextView
         android:id="@+id/tv_feedback"
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginTop="@dimen/margin_default"
-        android:paddingStart="@dimen/margin_default"
-        android:paddingEnd="@dimen/margin_default"
+        android:layout_marginStart="@dimen/margin_default"
+        android:layout_marginEnd="@dimen/margin_default"
         android:text="意见反馈"
         android:textColor="@color/green_logo"
         android:textSize="@dimen/text_normal_s"
-        android:textStyle="bold" />
+        android:textStyle="bold"
+        android:background="?attr/selectableItemBackground"/>
 
     <TextView
         android:id="@+id/tv_update"
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginTop="@dimen/margin_default"
-        android:paddingStart="@dimen/margin_default"
-        android:paddingEnd="@dimen/margin_default"
+        android:layout_marginStart="@dimen/margin_default"
+        android:layout_marginEnd="@dimen/margin_default"
         android:text="检查更新"
         android:textColor="@color/green_logo"
         android:textSize="@dimen/text_normal_s"
-        android:textStyle="bold" />
+        android:textStyle="bold"
+        android:background="?attr/selectableItemBackground"/>
 
     <Space
         android:layout_width="wrap_content"

+ 2 - 3
app/src/main/res/values/dimens.xml

@@ -16,9 +16,6 @@
     <dimen name="design_bottom_navigation_margin" tools:override="true">7.5dp</dimen>
     <dimen name="design_navigation_icon_padding" tools:override="true">6dp</dimen>
 
-    <dimen name="size_hello">20sp</dimen>
-    <dimen name="size_title">16sp</dimen>
-    <dimen name="size_title_s">15sp</dimen>
     <dimen name="size_icon_big">32dp</dimen>
     <dimen name="size_icon">20dp</dimen>
 
@@ -41,6 +38,8 @@
     <dimen name="size_image_ss">16dp</dimen>
     <dimen name="size_image_sss">8dp</dimen>
 
+    <dimen name="size_hello">20sp</dimen>
+    <dimen name="size_title_s">15sp</dimen>
     <dimen name="text_title">17sp</dimen>
     <dimen name="text_sub_title">16sp</dimen>
     <dimen name="text_normal_p">14.5sp</dimen>