Search code examples
androidopengl-esvirtual-reality

How to hide two buttons in GvrView


In google's Cardboard API we can use CardboardView.setSettingsButtonEnabled(boolean) method to hide the settings button on the bottom of the screen. enter image description here Now,Google VR API is graded to 1.0. Use GvrView insteads of 'CardboardView', and the settings button is moved to top|right when adding a close button on left|top, but I can't find any GvrView's methods which can hide the two buttons. Please help me how to fix it, Thanks


Solution

  • In the current version (1.170.0) of the GVR SDK. You can find the buttons and remove them (but only in older versions of Android):

    // Settings Button
    val settingsButton = gvrView.findViewById<ImageButton>(R.id.ui_settings_button)
    settingsButton.visibility = View.GONE
    
    // Back Button
    val backButton = gvrView.findViewById<ImageButton>(R.id.ui_back_button)
    backButton.visibility = View.GONE
    
    // Alignment Marker
    val alignmentMarker = gvrView.findViewById<RelativeLayout>(R.id.ui_alignment_marker)
    alignmentMarker.visibility = View.GONE