简体   繁体   English

如何使视图适合布局?

[英]How to make a view fit a layout?

I have a main layout in which i'm adding dynamic view inflated, i do this add in scale with the main layout but in some cases the view exceeds the mainl layout height.How can i tell them to stick to the layout height and not cross over? 我有一个主布局,其中我添加了膨胀的动态视图,我这样做是在主布局中按比例增加的,但是在某些情况下,视图超出了mainl布局的高度。我如何告诉他们坚持布局的高度而不是越过?

Thank you 谢谢

Please provide the code, so that I can help you by analyzing it. 请提供代码,以便我们通过分析为您提供帮助。 Try using proper LayoutParams. 尝试使用适当的LayoutParams。 why do you want to add View dynamically. 为什么要动态添加视图。 If you can make it in XML, make it! 如果可以用XML制作,那就制作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM