在我点击屏幕以初始化ARcore之前,我的DrawerLayout可以正常工作,但是当我初始化ARcore并尝试打开Drawer Menu(抽屉菜单)时,它没有打开,我不明白为什么,我认为这可能是ARcore的问题。有想法吗?
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<RelativeLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/ar_fragment"
android:name="com.google.ar.sceneform.ux.ArFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:padding="20dp"
android:src="@drawable/logo" />
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/backBlue"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:scrollbars="vertical" />
class MainActivity : AppCompatActivity() {
private val arFragment: ArFragment by lazy {
supportFragmentManager.findFragmentById(R.id.ar_fragment) as ArFragment
}
private val drawerLayout: DrawerLayout by lazy {
findViewById<DrawerLayout>(R.id.drawer_layout)
}
private val drawerRecyclerView: RecyclerView by lazy {
findViewById<RecyclerView>(R.id.recycler_view)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_ar)
drawerRecyclerView.setHasFixedSize(true)
drawerRecyclerView.layoutManager = LinearLayoutManager(this)
initLogic()
}
private fun initLogic() {
val arController = ArHandler(this, arFragment)
drawerRecyclerView.adapter = DrawerRecyclerViewAdapter(GameDAO.instance.game.possession)
arController.initAR()
}