- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我有的 XML
<androidx.fragment.app.FragmentContainerView
android:id="@+id/identifications_map_view"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent" />
我想从 View 中获取 fragment 。
documentation建议使用
FragmentContainerView fcv = findViewById(R.id.identifications_map_view);
SupportMapFragment smf = fcv.getFragment()
但是 Android Studio 无法解析符号,如果我 CTRL+单击“FragmentContainerView”,当我使用 CTRL+F 搜索时它不会显示 getFragment()。
最佳答案
它已从 1.4.0-alpha01 ( https://developer.android.com/jetpack/androidx/releases/fragment#1.4.0-alpha01 ) 添加
如果您使用的是较低版本,它将不存在。
关于java - 在我的 FragmentContainerView 对象中找不到方法 getFragment(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68018322/
我正在使用 viewpager 并编译 API 23。我在我的代码中显示以下语句的编译错误,但该项目确实可以编译。 List fragments = getSupportFragmentManager
我正在使用支持库 v4,但未能保存 fragment 的状态。 @Override protected void onSaveInstanceState(Bundle outState) {
调用 getSupportFragmentManager().getFragments() 显示编译时错误,并显示以下消息: getSupportFragmentManager().getFragme
在我有的 XML 我想从 View 中获取 fragment 。 documentation建议使用 FragmentContainerView fcv = findViewById(R.id.id
我有一个托 pipe fragment 的父 fragment 。我对我的应用程序进行了压力测试,通过在开发人员选项中选中“不保留 Activity ”,然后按下主页按钮来强制终止它。 可以看到父 f
我正在开发 Android 3.1 平板电脑应用程序。 我在一项 Activity 中使用 ViewPager 和 fragment 。我的问题是我不知道如何为 fragment 设置 ID 或标签。
更重要的是,在 onCreate/onCreateView 中,我已经调用 FragmentManager.findFragmentByTag() 来查找我的 fragment 的任何现有实例,它似乎
我有一个使用 fragment 的应用程序,我正在研究如何在具有双 Pane 的 Activity 和作为独立的 Activity 中使用相同的 fragment 。仍然不确定完成此操作的最佳方法,但
URL.getRef() 和 URI.getFragment() 是一样的吗? 如果不是,它们有何不同? 运行下面的测试时,结果是一样的: String url = "http://c.b.a.com
从 SDK 26.0.0-beta1 及更高版本开始,使用 getFragments https://developer.android.com/reference/android/support/v
getFragments 方法在最新版本的支持库中被注释为@RestrictTo(LIBRARY_GROUP),这意味着它不供外部使用。 version history 中没有此更改的记录但对于早期版
编辑 2 我现在设法摆脱了使用这里的技巧 https://code.google.com/p/android/issues/detail?id=42601#c10 的错误所以这就是为什么我最后一次编辑
我有 TabLayout,其中使用 FragmentPagerAdapter 通过 ViewPager 创建了 3 个选项卡和 3 个 fragment 。滑动到第三个选项卡,中断第一个选项卡的一位并
我是一名优秀的程序员,十分优秀!