浏览代码

[알림][Common] 상단탭바 스크롤시 축소되게 수정

Hasemi 7 年之前
父节点
当前提交
f5355fec60

+ 3 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/notification/NotiFragment.java

@@ -37,6 +37,7 @@ public class NotiFragment extends FragmentBase<NotiPresenter> implements INotiVi
   public static final int CATEGORY_KEY_MEMBER = 1;
   public static final int CATEGORY_KEY_BENEFIT = 2;
   private TabLayout tabLayoutAlarm;
+  private TabLayout tabBarLayoutAlarm;
   private ViewPager viewPagerAlarm;
 
   @Override
@@ -49,7 +50,7 @@ public class NotiFragment extends FragmentBase<NotiPresenter> implements INotiVi
     tabLayoutAlarm = findViewById(R.id.alarm_tab_layout);
     viewPagerAlarm = findViewById(R.id.alarm_view_pager);
     tabLayoutAlarm.setTabGravity(TabLayout.GRAVITY_FILL);
-
+    tabBarLayoutAlarm = findViewById(R.id.noti_tab_bar);
   }
 
   @Override
@@ -96,6 +97,7 @@ public class NotiFragment extends FragmentBase<NotiPresenter> implements INotiVi
     String[] tab = {CATEGORY_ALL, CATEGORY_NEWS, CATEGORY_NOTICE};
     NotiPagerAdapter notiPagerAdapter = new NotiPagerAdapter(getChildFragmentManager(), tab, beans);
     tabLayoutAlarm.setupWithViewPager(viewPagerAlarm, true);
+    tabBarLayoutAlarm.setupWithViewPager(viewPagerAlarm, true);
     viewPagerAlarm.setAdapter(notiPagerAdapter);
     notiPagerAdapter.notifyDataSetChanged();
   }

+ 56 - 13
app/src/main/res/layout/fragment_noti.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
+<android.support.design.widget.CoordinatorLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
@@ -9,27 +9,70 @@
   android:background="@color/CFFFFFF"
   android:orientation="vertical">
 
-  <android.support.design.widget.TabLayout
-    android:id="@+id/alarm_tab_layout"
+  <android.support.design.widget.AppBarLayout
     android:layout_width="match_parent"
-    android:layout_height="55dp"
-    android:layout_marginLeft="25dp"
-    android:layout_marginRight="25dp"
+    android:layout_height="wrap_content"
     android:background="@color/CFFFFFF"
-    app:tabBackground="@drawable/tab_indicator"
-    app:tabGravity="center"
-    app:tabIndicatorColor="@color/C000000"/>
+    app:elevation="0dp"
+    >
 
-  <RelativeLayout
+    <android.support.design.widget.CollapsingToolbarLayout
+      android:id="@+id/collapsing_tool_bar"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:background="@color/CFFFFFF"
+      app:layout_scrollFlags="scroll|exitUntilCollapsed">
+
+      <android.support.design.widget.TabLayout
+        android:id="@+id/alarm_tab_layout"
+        android:layout_width="match_parent"
+        android:layout_height="55dp"
+        android:layout_marginStart="25dp"
+        android:layout_marginEnd="25dp"
+        app:layout_collapseMode="parallax"
+        app:tabIndicatorHeight="0dp"/>
+
+      <android.support.v7.widget.Toolbar
+        android:id="@+id/toolbar_invisible"
+        android:layout_width="match_parent"
+        android:layout_height="30dp"
+        android:background="@null"
+        android:visibility="invisible"
+        app:elevation="0dp"
+        app:layout_collapseMode="pin"
+        app:layout_scrollFlags="scroll"
+        tools:visibility="visible"
+        />
+
+    </android.support.design.widget.CollapsingToolbarLayout>
+
+    <android.support.design.widget.TabLayout
+      android:id="@+id/noti_tab_bar"
+      android:layout_width="match_parent"
+      android:layout_height="3dp"
+      android:layout_gravity="bottom"
+      android:layout_marginStart="25dp"
+      android:layout_marginEnd="25dp"
+      android:clickable="false"
+      app:tabBackground="@color/CEBEBEB"
+      app:tabIndicatorHeight="3dp"
+      app:tabTextColor="@color/CEBEBEB"
+      />
+
+  </android.support.design.widget.AppBarLayout>
+
+  <LinearLayout
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    app:layout_behavior="@string/appbar_scrolling_view_behavior"
+    >
 
     <android.support.v4.view.ViewPager
       android:id="@+id/alarm_view_pager"
       android:layout_width="match_parent"
       android:layout_height="match_parent"/>
 
-  </RelativeLayout>
+  </LinearLayout>
 
 
-</LinearLayout>
+</android.support.design.widget.CoordinatorLayout>

+ 2 - 0
app/src/main/res/layout/noti_text_contents.xml

@@ -31,6 +31,8 @@
     android:lineSpacingExtra="6sp"
     android:textColor="@color/C333333"
     android:textSize="14sp"
+    app:layout_constraintEnd_toEndOf="parent"
+    android:layout_marginEnd="23dp"
     app:layout_constraintStart_toStartOf="parent"
     app:layout_constraintTop_toBottomOf="@+id/text_view_category"
     tools:text="포인트 소멸 안내3일 이내 포인트가 소멸될 예정입니다.