当前位置: 首页> 汽车> 行情 > materail3 CircularProgressIndicator和LinearProgressIndicator有难看的白块和断点

materail3 CircularProgressIndicator和LinearProgressIndicator有难看的白块和断点

时间:2025/7/8 2:00:08来源:https://blog.csdn.net/jzlhll123/article/details/142000286 浏览次数: 0次

请添加图片描述
看看,就是这个垃圾效果:
圆圈的进度条有断点,不连接;
横线进度条,有尾部亮色,进度处又有分割。

它的原出处在这里:https://m3.material.io/components/progress-indicators/overview,官方设计。

Differences from M2:
Contrast: Higher contrast between track and active indicator to enhance the perception of progress

看看,连老外都在吐槽,https://www.reddit.com/r/androiddev/comments/19bwskv/is_the_new_material_3_linear_progress_indicator/?rdt=44295。这种设计实在是令人费解。

于是我翻看源码,最终找到了解决办法:

方案1, 对于这2个控件设置属性:

<com.google.android.material.progressindicator.LinearProgressIndicator
...
app:trackStopIndicatorSize="0dp"
app:indicatorTrackGapSize="0dp"/><com.google.android.material.progressindicator.CircularProgressIndicator
...
app:indicatorTrackGapSize="0dp"/>

方案2, 将M3设计的这2个size去掉:

    <dimen name="m3_comp_progress_indicator_active_indicator_track_space" tools:override="true">0dp</dimen><dimen name="m3_comp_progress_indicator_stop_indicator_size" tools:override="true">0dp</dimen>

最后还原了原来的效果:
请添加图片描述

关键字:materail3 CircularProgressIndicator和LinearProgressIndicator有难看的白块和断点

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: