且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在React Native应用程序中加载片段

更新时间:2021-11-22 04:19:29

您可以将自己的容器添加到现有布局.例如:

You can add your own container to the existing layout. For example:

window.decorView.findViewById<ViewGroup>(android.R.id.content)
            .addView(
                    FrameLayout(this).apply {
                        id = R.id.fragment_container
                        layoutParams = FrameLayout.LayoutParams(
                                FrameLayout.LayoutParams.MATCH_PARENT,
                                FrameLayout.LayoutParams.MATCH_PARENT
                        )
                    }
            )

现在,您可以将片段添加到此容器中. 另外,此库可能会有所帮助- https://github.com/hudl/react-native -android-fragment

Now you can add your fragment to this container. Also this library might be helpful - https://github.com/hudl/react-native-android-fragment