How can I get the cordova InAppBrowser to provide a way for the user to close the browser when using an Android device?

后端 未结 8 448
礼貌的吻别
礼貌的吻别 2020-12-13 04:57

I\'m using the cordova InAppBrowser to display content from an external site in my app. When I open the browser on an iPhone, there are some buttons at the bottom of the InA

8条回答
  •  囚心锁ツ
    2020-12-13 05:24

    To keep the option 'location=yes' to behave the same on Android and iOS I would suggest to modify Troy's fix with the following change that moves the if statement to control the "toolbar.addView(edittext);" and not the entire toolbar.

    // Add the views to our toolbar
    toolbar.addView(actionButtonContainer);
    if (getShowLocationBar()) {
        toolbar.addView(edittext);
    }
    toolbar.addView(close);
    
    // Add our toolbar to our main view/layout
    main.addView(toolbar);
    

    Compared to the original code:

    // Add the views to our toolbar
    toolbar.addView(actionButtonContainer);
    toolbar.addView(edittext);
    toolbar.addView(close);
    
    // Don't add the toolbar if its been disabled
    if (getShowLocationBar()) {
        // Add our toolbar to our main view/layout
        main.addView(toolbar);
    }
    

提交回复
热议问题