是否可以將Phonegap僅用於應用程序的一部分?是否可以使用phonegap作爲應用程序的一部分?
例如在Android上(但我的問題還包括其他操作系統),Activity可以使用Phonegap組件和本地組件(在同一屏幕中)嗎?
謝謝。
是否可以將Phonegap僅用於應用程序的一部分?是否可以使用phonegap作爲應用程序的一部分?
例如在Android上(但我的問題還包括其他操作系統),Activity可以使用Phonegap組件和本地組件(在同一屏幕中)嗎?
謝謝。
下面的小經驗似乎回答了我的需求,至少在Android上。我想在另一個操作系統上可以做類似的黑客攻擊。
public class TestPhonegapActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadUrl("file:///android_asset/www/index.html");
LinearLayout linearLayout = new LinearLayout(this);
((ViewGroup) appView.getParent()).removeView(appView);
linearLayout.addView(appView);
TextView textView = new TextView(this);
textView.setText("Native");
linearLayout.addView(textView);
setContentView(linearLayout);
}
}
您可以簡單地使用:
LinearLayout layout = super.root;
然後添加你想要什麼:
TextView textView = new TextView(this);
textView.setText("Native");
linearLayout.addView(textView);
您可以使用網頁視圖.. –
網頁視圖並不讓我使用的API, appcelerator提供(加速度計,相機,...) –
這就是PhoneGap給你的。其API包括加速計,相機等。 PhoneGap代碼在WebView中運行 –