xiongzhu 7 ani în urmă
părinte
comite
2c4ccba82f

+ 5 - 5
app/src/main/java/com/android/chmo/ui/fragment/HomeFragment.java

@@ -27,10 +27,10 @@ import static com.android.chmo.R.id.pager;
  */
 
 public class HomeFragment extends BaseFragment {
-    private final int PAGE_FOLLOW = 0;
+    private final int PAGE_FOLLOW    = 0;
     private final int PAGE_RECOMMEND = 1;
-    private final int PAGE_ACTOR = 2;
-    private final int PAGE_ACTIVITY = 3;
+    private final int PAGE_ACTOR     = 2;
+    private final int PAGE_ACTIVITY  = 3;
 
     @BindView(R.id.top)
     View topBar;
@@ -89,7 +89,7 @@ public class HomeFragment extends BaseFragment {
     void initTopBar() {
         int statusBarHeight = CommonUtils.getStatusBarHeight(getBaseActivity());
         LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) topBar.getLayoutParams();
-        lp.height = PixelUtils.dp2px(55, getContext()) + statusBarHeight;
+        lp.height = getResources().getDimensionPixelSize(R.dimen.top_bar_height) + statusBarHeight;
         topBar.setPadding(0, statusBarHeight, 0, 0);
         topBar.setLayoutParams(lp);
     }
@@ -122,7 +122,7 @@ public class HomeFragment extends BaseFragment {
     }
 
     private void changeTab() {
-        if(curTab != null) {
+        if (curTab != null) {
             curTab.setSelected(false);
         }
         switch (curPage) {

+ 5 - 0
app/src/main/res/drawable/indicator.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="@color/pink" />
+    <corners android:radius="1.5dp" />
+</shape>

+ 4 - 4
app/src/main/res/drawable/tab_line.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:drawable="@color/pink" android:state_checked="true"></item>
-    <item android:drawable="@color/pink" android:state_selected="true"></item>
-    <item android:drawable="@color/pink" android:state_pressed="true"></item>
-    <item android:drawable="@color/transparent"></item>
+    <item android:drawable="@drawable/indicator" android:state_checked="true" />
+    <item android:drawable="@drawable/indicator" android:state_selected="true" />
+    <item android:drawable="@drawable/indicator" android:state_pressed="true" />
+    <item android:drawable="@color/transparent" />
 </selector>

+ 2 - 2
app/src/main/res/layout/activity_main.xml

@@ -126,8 +126,8 @@
 
     <ImageView
         android:id="@+id/find"
-        android:layout_width="55dp"
-        android:layout_height="55dp"
+        android:layout_width="50dp"
+        android:layout_height="50dp"
         android:src="@mipmap/tab_find"
         android:layout_alignParentBottom="true"
         android:layout_centerHorizontal="true"

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

@@ -3,6 +3,6 @@
     <dimen name="activity_horizontal_margin">16dp</dimen>
     <dimen name="activity_vertical_margin">16dp</dimen>
 
-    <dimen name="top_bar_height">50dp</dimen>
-    <dimen name="bottom_bar_height">55dp</dimen>
+    <dimen name="top_bar_height">44dp</dimen>
+    <dimen name="bottom_bar_height">50dp</dimen>
 </resources>

+ 4 - 4
app/src/main/res/values/styles.xml

@@ -101,9 +101,9 @@
     </style>
 
     <style name="tabFont">
-        <item name="android:textSize">12sp</item>
+        <item name="android:textSize">10sp</item>
         <item name="android:textColor">@color/tab_text_selector</item>
-        <item name="android:layout_marginTop">6dp</item>
+        <item name="android:layout_marginTop">4dp</item>
     </style>
 
     <style name="TopTabFont">
@@ -115,10 +115,10 @@
     </style>
 
     <style name="TopTabLine">
-        <item name="android:layout_width">40dp</item>
+        <item name="android:layout_width">16dp</item>
         <item name="android:layout_height">3dp</item>
         <item name="android:background">@drawable/tab_line</item>
-        <item name="android:layout_marginTop">6dp</item>
+        <item name="android:layout_marginTop">2dp</item>
     </style>
 
     <style name="TabLine">