本文主要是介绍materail3 CircularProgressIndicator和LinearProgressIndicator有难看的白块和断点,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
看看,就是这个垃圾效果:
圆圈的进度条有断点,不连接;
横线进度条,有尾部亮色,进度处又有分割。
它的原出处在这里: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有难看的白块和断点的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!