安卓的PhoneGap与本地控件 [英] Android PhoneGap with Native Controls

查看:142
本文介绍了安卓的PhoneGap与本地控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个Android应用程序与PhoneGap的。

I am trying to build an Android application with PhoneGap.

我需要能够使用PhoneGap的的WebView(super.appView)及其所有的JavaScript的魔法,但我还需要各地的WebView显示一些原生UI控件。

I need to be able to use the PhoneGap WebView (super.appView) and all of its javascript magic but I also need to display some native UI controls around the WebView.

这后接着部分的方式来提供解决方案<一href="http://stackoverflow.com/questions/7174434/android-phonegap-plugin-ui-tabbar-resize-webview">Android PhoneGap的插件,用户界面​​的TabBar,调整的WebView

This post goes part way to providing a solution Android PhoneGap Plugin, UI tabbar, resize WebView

有没有人成功地实现PhoneGap的一个原生的UI?

Has anyone managed to implement PhoneGap with a native UI?

我也将使用GestureOverlayView但那是另一回事;)

I will also be using a GestureOverlayView but thats another story ;)

推荐答案

答:

super.onCreate(savedInstanceState);
//creates super.appView and calls setContentView(root) in DroidGap.java
init();
//just an empty LinearLayout
layoutId = R.layout.blank;
view = new LinearLayout(this);
setContentView(layoutId);
view.addView(your_component_here);
view.addView((View) appView.getParent()); //adds the PhoneGap browser at index 1
//accesses the browser at index 1. Tells browser to not fill view
view.getChildAt(1).setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1));
setContentView(view);

我会努力告诉你如何工作的,我可以告诉你的是,它确实,这是我自己的工作。

I would struggle to tell you how this works, all I can tell you is that it does and it is all my own work.

视图设置为不同的颜色可以帮助你看到正在发生的事情太多......

Setting the view to a different colour can help you to see what is going on too....

view.setBackgroundColor(Color.BLUE);

与PhoneGap的-1.0.0.jar工作的最新版本为止。

Working with PhoneGap-1.0.0.jar the latest release so far.

这篇关于安卓的PhoneGap与本地控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆