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

custom-view的宽或高设置为wrap_content时,能否支持类似text组件的fit-content效果,控件内部实现测量方法后自动把父布局撑开? #271

Open
zhinengfeiyu opened this issue Nov 17, 2022 · 4 comments
Assignees
Labels

Comments

@zhinengfeiyu
Copy link

zhinengfeiyu commented Nov 17, 2022

因为自定义组件的宽高很多都是在设置数据后,在onMeasure()通过复杂的逻辑计算后才确定的,无法预先确定占用的空间。

目前自定义view的能力实际上是给挖了一个确定宽高后的坑,你的自定义view可以在这个坑里随便展示。

这里期望的是能通过自定义view的宽高,反过来影响整个模板的计算结果,也就是给模板中的custom-view的宽高都设置成了auto,期望由custom-view来撑开。目前不支持这个能力。

@pj0579
Copy link
Contributor

pj0579 commented Nov 18, 2022

官方的text组件能支持自适应 Android这边自定义TextView需要怎么实现自适应 目前也是需要设置固定宽高

@biezhihua
Copy link
Collaborator

官方的text组件能支持自适应 Android这边自定义TextView需要怎么实现自适应 目前也是需要设置固定宽高

之前倒是没有考虑过这个场景。我们一起讨论一下。

@pj0579
Copy link
Contributor

pj0579 commented Nov 20, 2022

官方的text组件能支持自适应 Android这边自定义TextView需要怎么实现自适应 目前也是需要设置固定宽高

之前倒是没有考虑过这个场景。我们一起讨论一下。

官方text组件不定行固定宽的时候 也是相当于提前在GXFitContentUtils计算出高度进行绘制的吧 能把这个计算托管出来 对应不同的自定义view 可以自己设置不同的计算规则

@biezhihua
Copy link
Collaborator

@pj0579 是的。 这块需要设置custom view的计算规则。

由于近期业务较忙,相关问题跟进较慢,请耐心等待。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants