为了能够看到预览Android Studio中的布局时,一个片段内部的某一观点的内容,它是可以做到这样:
<MainLayoutView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<fragment
...
tools:layout="@layout/my_fragment_view"/>
</MainLayoutView>
Run Code Online (Sandbox Code Playgroud)
但是,如果您从 切换fragment到androidx.fragment.app.FragmentContainerView,这个方便的工具将停止工作,片段在预览屏幕上只会显示为空白。
FragmentContainerView在 Android Studio 的布局中预览内容时,有没有办法在 a 中显示内容?