Forum Discussion

BigMac1771's avatar
BigMac1771
Honored Guest
7 months ago
Solved

[Spatial SDK] Virtual keyboard is not shown.

Im executing the StarterSample on Quest3 v76.1024. I just add a EditText widget into ui_example.xml as below.

When I clicked the EditText, the virtual keyborad was not shown but sometime it was shown.

Here is the log filter by keyword "keyboard": log 

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="This is EditText"
android:textSize="20dp"
android:textColor="@color/design_default_color_error"
/>

<!--Button-->
<Button
android:id="@+id/ok_button"
android:layout_height="36dp"
android:layout_width="120dp"
android:layout_gravity="center"
android:text="Ok"
android:background="@drawable/button_bg"
android:textColor="#ffffff"
/>

 

  • We are working on a framework-level fix for this. However in the meantime we have a solution that should unblock you.

    In your main VR activity (inherits from AppSystemActivity) add this line into your onCreate:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)


    So this would look like:

    import android.view.WindowManager
    ...
    
    class MyVRActivity : AppSystemActivity() {
    ...
    
      override fun onCreate(savedInstanceState: Bundle?) {
        ...
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
      }
    }

     

4 Replies

  • pmcgvr's avatar
    pmcgvr
    Meta Employee

    Thank you for reporting this, the engineering team is looking into the issue.

  • pmcgvr's avatar
    pmcgvr
    Meta Employee

    We are working on a framework-level fix for this. However in the meantime we have a solution that should unblock you.

    In your main VR activity (inherits from AppSystemActivity) add this line into your onCreate:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)


    So this would look like:

    import android.view.WindowManager
    ...
    
    class MyVRActivity : AppSystemActivity() {
    ...
    
      override fun onCreate(savedInstanceState: Bundle?) {
        ...
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
      }
    }

     

→ Find helpful resources to begin your development journey in Getting Started

→ Get the latest information about HorizonOS development in News & Announcements.

→ Access Start program mentor videos and share knowledge, tutorials, and videos in Community Resources.

→ Get support or provide help in Questions & Discussions.

→ Show off your work in What I’m Building to get feedback and find playtesters.

→ Looking for documentation?  Developer Docs

→ Looking for account support?  Support Center

→ Looking for the previous forum?  Forum Archive

→ Looking to join the Start program? Apply here.

 

Recent Discussions