为什么Arcore片段正在工作时DrawerLayout不起作用?

问题描述 投票:1回答:1

问题

[在我点击屏幕以初始化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()
}
java android kotlin drawerlayout arcore
1个回答
0
投票

我有同样的问题。您设法解决了吗?谢谢!

© www.soinside.com 2019 - 2024. All rights reserved.