Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道我可以使用 xml 设置 minWidth 但我想知道如何在代码中设置它,因为我正在将代码中的线性布局添加到 View 但是当内容太小时所有布局的内容我正在添加更改等等,我需要从代码中设置最小宽度。
你必须使用viewInstance.setMinimumWidth (int minWidth). 你可以在这里阅读
viewInstance.setMinimumWidth (int minWidth)