由于我只从按钮更改为 RecyclerView (并且它与按钮一起工作得很好),我知道我的 java 代码工作正常,所以现在我面临一个问题,因为单击 RecyclerView 中的卡片会使用 FragmentManager 调用片段,但不会显示它。这是我的 Activity.xml 代码。
<线性布局
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"
安卓:layout_width =“match_parent”
安卓:layout_height =“match_parent”
机器人:方向=“垂直”>
<androidx.constraintlayout.widget.ConstraintLayout
安卓:layout_width =“match_parent”
安卓:layout_height =“match_parent”
工具:context=".mainSearch"
android:background="#f2f2f2">
<androidx.recyclerview.widget.RecyclerView
安卓:layout_width =“match_parent”
安卓:layout_height =“match_parent”
android:id="@+id/recyclerView"
android:orientation="水平" />
</androidx.constraintlayout.widget.ConstraintLayout>
<片段
android:name="com.diamcom.blue.StoneCodeFragment"
android:id="@+id/fragment_place"
安卓:layout_width =“match_parent”
机器人:layout_height =“match_parent”>
</片段>
</线性布局>
我想知道我做错了什么?