Просмотр исходного кода

修复 发现模块界面 tab 宽度算法

zengjiebin лет назад: 7
Родитель
Сommit
e1d9a7b24b

+ 3 - 1
app/src/main/java/com/kfzs/duanduan/fragment/FgtFind.java

@@ -120,6 +120,8 @@ public class FgtFind extends BaseCompatFragment {
 //                    int dp10 = dip2px(tabLayout.getContext(), 10);
                     int add = getResources().getDimensionPixelSize(R.dimen.content_padding_10);
                     int count = mTabStrip.getChildCount();
+                    int fillCount = Math.min(5, count);//一屏的个数
+
                     for (int i = 0; i < count; i++) {
                         View tabView = mTabStrip.getChildAt(i);
 
@@ -142,7 +144,7 @@ public class FgtFind extends BaseCompatFragment {
                         //设置tab左右间距为10dp  注意这里不能使用Padding 因为源码中线的宽度是根据 tabView的宽度来设置的
                         LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) tabView.getLayoutParams();
                         params.width = width ;
-                        int margin = (G.WIDTH - 5*width - 2*add) / 10;
+                        int margin = (G.WIDTH - fillCount*width - 2*add) / (fillCount*2);
                         params.leftMargin = margin + (i == 0 ? add : 0);
                         params.rightMargin = margin + (i + 1 == count ? add : 0);
                         tabView.setLayoutParams(params);

+ 2 - 1
app/src/main/res/layout/homepage_item_notice.xml

@@ -14,7 +14,8 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="绵羊公告"
-        style="@style/txt_style_16_black"/>
+        android:textSize="12sp"
+        android:textColor="@color/black_6_3"/>
     <ImageView
         android:layout_width="@dimen/content_padding_20"
         android:layout_height="@dimen/content_padding_20"