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.
这似乎是一个常见问题,但很难找到文档。我正在寻找向我展示如何创建自己的视图组(最好通过扩展已经存在的视图组)然后以编程方式添加视图的示例。
谢谢。
视图组
ViewGroup 是抽象的,它的onLayout也是抽象的。因此,您需要为 onLayout 提供一个实现,您可以在其中为视图组的每个子(视图)分配一个位置。