Open sangsais opened 6 years ago
升级一下新版本,重写了计算高度的逻辑
升级也会有被裁减现象,而且还改变了样式。。。还没看为什么会被覆盖样式
核心布局代码贴出来看看?
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/color_ffffff" android:orientation="vertical">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlAccentColor="@color/color_7d7d7d"
app:srlDragRate="0.7"
app:srlEnableHeaderTranslationContent="true"
app:srlEnableLoadmore="false"
app:srlHeaderMaxDragRate="1.3"
app:srlPrimaryColor="@color/color_f4f4f4">
<com.dfs168.ttxn.widget.ClassicsHeader
android:id="@+id/classics_head_allf"
android:layout_width="match_parent"
android:layout_height="35dp"
app:srlClassicsSpinnerStyle="FixedBehind"
app:srlDrawableArrow="@drawable/ic_rf_arrow"
app:srlDrawableArrowSize="15dp"
app:srlDrawableMarginRight="20dp"
app:srlDrawableProgress="@drawable/ic_progress_hojder"
app:srlDrawableProgressSize="15dp"
app:srlEnableLastTime="true"
app:srlFinishDuration="1"
app:srlTextSizeTime="@dimen/x10"
app:srlTextSizeTitle="13sp"
app:srlTextTimeMarginTop="2dp" />
<include
layout="@layout/learn_record_up_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_learn_record"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
---------headview---------
<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" android:id="@+id/ll_learn_record_rview" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/color_ffffff" android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/x340">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_look_back_ic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@mipmap/iv_look_back" />
<TextView
android:id="@+id/tv_look_back_learn_times"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/x33"
tools:text="您本月总共学习了 9527 分钟" />
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/y16"
android:background="@color/color_f4f4f4" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/x80">
<RelativeLayout
android:id="@+id/rl_up_year"
android:layout_width="@dimen/x100"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/rl_left_up_month">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/ic_up_year" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_left_up_month"
android:layout_width="@dimen/x100"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/x50"
android:layout_toLeftOf="@+id/tv_current_yandm">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/ic_up_month" />
</RelativeLayout>
<TextView
android:id="@+id/tv_current_yandm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="@color/color_666666"
android:textSize="@dimen/x28"
tools:text="2018年7月" />
<RelativeLayout
android:id="@+id/rl_left_next_month"
android:layout_width="@dimen/x100"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/x50"
android:layout_toRightOf="@+id/tv_current_yandm">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/ic_next_month" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_left_next_year"
android:layout_width="@dimen/x100"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/rl_left_next_month">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/ic_next_year" />
</RelativeLayout>
</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.haibin.calendarview.CalendarLayout
android:id="@+id/calendarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/x60"
android:background="#fff"
android:orientation="vertical">
<!--
mode_only_current mode_fix mode_all calendar_padding
app:calendar_height="@dimen/x100"
-->
<com.haibin.calendarview.CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
app:current_month_lunar_text_color="@color/color_ff7200"
app:current_month_text_color="#333333"
app:max_year="2020"
app:min_year="2017"
app:month_view="com.dfs168.ttxn.widget.MeiZuMonthView"
app:month_view_scrollable="true"
app:month_view_show_mode="mode_only_current"
app:other_month_lunar_text_color="#e1e1e1"
app:other_month_text_color="@color/color_bbbbbb"
app:scheme_text="假"
app:scheme_text_color="#333"
app:scheme_theme_color="#128c4b"
app:selected_lunar_text_color="#CFCFCF"
app:selected_text_color="#333"
app:selected_theme_color="#80cfcfcf"
app:week_background="@color/color_ff7200"
app:week_bar_height="0dp"
app:week_start_with="mon"
app:week_text_color="#111111"
app:week_view_scrollable="true"
app:year_view_day_text_color="#333333"
app:year_view_day_text_size="9sp"
app:year_view_month_text_color="#ff0000"
app:year_view_month_text_size="20sp"
app:year_view_scheme_color="#f17706" />
<!--app:week_view="com.dfs168.ttxn.widget.MeizuWeekView"-->
</com.haibin.calendarview.CalendarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/x64"
android:gravity="center_horizontal|center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/color_e5e5e5"
android:gravity="center_horizontal|center_vertical"
android:text="周一"
android:textColor="@color/color_666666"
android:textSize="@dimen/x24" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/color_e5e5e5"
android:gravity="center_horizontal|center_vertical"
android:text="周二"
android:textColor="@color/color_666666"
android:textSize="@dimen/x24" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/color_e5e5e5"
android:gravity="center_horizontal|center_vertical"
android:text="周三"
android:textColor="@color/color_666666"
android:textSize="@dimen/x22" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/color_e5e5e5"
android:gravity="center_horizontal|center_vertical"
android:text="周四"
android:textColor="@color/color_666666"
android:textSize="@dimen/x24" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/color_e5e5e5"
android:gravity="center_horizontal|center_vertical"
android:text="周五"
android:textColor="@color/color_666666"
android:textSize="@dimen/x24" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/color_f2f2f2"
android:gravity="center_horizontal|center_vertical"
android:text="周六"
android:textColor="@color/color_666666"
android:textSize="@dimen/x24" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/color_f2f2f2"
android:gravity="center_horizontal|center_vertical"
android:text="周日"
android:textColor="@color/color_666666"
android:textSize="@dimen/x24" />
</LinearLayout>
</FrameLayout>
<!--<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>-->
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/y16"
android:background="@color/color_f4f4f4" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/x80">
<TextView
android:layout_width="@dimen/x50"
android:layout_height="@dimen/y1"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/x15"
android:layout_toLeftOf="@+id/tv_cen_lhtitle_tips"
android:background="@color/color_e5e5e5" />
<TextView
android:id="@+id/tv_cen_lhtitle_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="本月已学记录"
android:textColor="@color/color_333333"
android:textSize="@dimen/x28"
android:textStyle="bold" />
<TextView
android:layout_width="@dimen/x50"
android:layout_height="@dimen/y1"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/x15"
android:layout_toRightOf="@+id/tv_cen_lhtitle_tips"
android:background="@color/color_e5e5e5" />
</RelativeLayout>
你用错了布局方式了,CalendarLayout不是这么用的,CalendarLayout用来处理CalendarView和ContentView的平移处理达到周月视图平移切换的,而你的CalendarLayout里面就一个CalendarView的话就可以不用CalendarLayout,而CaledarView内部也包含了周栏了,没必要再添加周栏了
去掉CalendarLayout依旧被裁减
用垂直线性布局 不使用写死本地的周栏 使用自带的周栏也是被裁 用的3.3.4验证 3.4.7会覆盖我画的样式
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
<com.haibin.calendarview.CalendarLayout
...
这里的android:layout_height="match_parent"也不对,你贴出的代码好几个地方得优化
上面回复的代码被截断了,<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"/>这里高度不能这样写啊,你这样作为header,外层的测量不对的
再次用3.4.7也是被裁
match_parent 不行么?
issue回复代码都被截断了,你加我QQ吧,1505651581,你最外层为LinearLayout高度为wrap_content,那CalendarView的Parent FrameLayout就肯定不能match_parent,这样意味着FrameLayout的高度已经确定了,而CalendarView的高度没确定就会有问题
implementation 'com.haibin:calendarview:3.3.4'
把CalendarView以addHeaderView(mHeaderView);形式添加到recycle后,显示问题
最后一行会被裁剪 或者 多出一段空隙
暂时发现只会在行数等于5行的时候出现
不止一台测试器复现
下面附一张裁剪的 一张多出空隙的图