Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置Border宽度超过CornersRadius2倍,不设置padding时,边框圆角效果消失 #2705

Open
yanshuai615270 opened this issue Mar 3, 2023 · 0 comments

Comments

@yanshuai615270
Copy link

yanshuai615270 commented Mar 3, 2023

Description

what i did:设置Border宽度超过CornersRadius2倍,不设置padding;

expected to happen: 边框圆角效果存在
image

actually happen:边框圆角效果消失
image

Reproduction

  val v = findViewById<SimpleDraweeView>(R.id.example)
  v.bindUrls(
    urls, 500, 500, null, callerCtx, null
  )
  val hierarchy = v.hierarchy;
  hierarchy.roundingParams = RoundingParams()
    .setBorder(Color.RED, getResources().getDisplayMetrics().density * 41 + 0.5f)
    .setScaleDownInsideBorders(true)
    .setCornersRadius(getResources().getDisplayMetrics().density * 20 + 0.5f)

Solution

问题:使用下面这个逻辑的原因是什么?
分析代码发现,造成这个效果的原因是,在RoundedColorDrawable.java中#updatePath方法中,在计算BorderRadii的时候采用了如下算法:mBorderRadii[i] = mRadii[i] + mPadding - mBorderWidth / 2;
image

Additional Information

  • Fresco version:2.4.0
  • Platform version: ALL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant