android-fragments - 在 Android 中动态添加 View 到 fragment ?

标签 android-fragments android android-view

是否可以动态地向 fragment 添加 View ?如果是,我该怎么做?

最佳答案

Is it possible to add a View to a Fragment dynamically?

是的。

If it is, how can i do that?

与在其他任何地方添加 View 的方式相同:在 View 的父容器上调用 addView()

关于android-fragments - 在 Android 中动态添加 View 到 fragment ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7512369/

相关文章:

android - 抽屉导航 fragment 在顶部被切断

android - 如果浏览器启动了我的 Activity,如何从 Activity 堆栈中删除浏览器?

java - 在 Java 中删除二维数组中的空元素

android - 我如何在 Android XML 布局文件中使用 View 节点?

android - 如何创建克隆重复 View ?

java - 为 BottomNavigationView 中的导航项添加边距

android - Livedata无法正确更新 fragment 中的数据

java - Android Fragment 回按

android - 不立即分离 fragment

javascript - 如何从本地创建的文件夹加载 WebView 上的网页?