Android PhoneGap with Native Controls

前端 未结 3 822
醉酒成梦
醉酒成梦 2020-12-14 05:08

I am trying to build an Android application with PhoneGap.

I need to be able to use the PhoneGap WebView (super.appView) and all of its javascript magic but I also n

3条回答
  •  醉话见心
    2020-12-14 05:28

    A more cleaner approach:

    super.onCreate(savedInstanceState);
    
    // Create native view with UI controls.
    View header = View.inflate(getContext(), R.layout.header, null);
    
    // PhoneGaps WebView is located inside a LinearLayout.
    // The protected (and therefore inherited) variable root
    // references this LinearLayout. Add your native Views
    // to this variable.
    root.addView(header);
    
    // Create WebView and add it automatically to the LinearLayout.
    super.loadUrl("file:///android_asset/www/index.html");
    

提交回复
热议问题