Android PhoneGap插件,UI标签栏,调整WebView大小

All*_*lly 13 java plugins android webview cordova

我正在创建一个美味的PhoneGap插件,希望它一旦准备好就会被打开..插件大部分都已完成,我只需要一个很好的UI用户交互.

简而言之,我想创建一个"原生"android工具栏组件.如果您为Decaf Ninja Software实施IOS的PhoneGap UIControls Tabbar库,您将如何做.

理想的情况下;

  • 应该从JavaScript通过PhoneGap调用工具栏到"显示"和"隐藏".
  • 在这些调用中,当工具栏从屏幕底部出现/消失时, WebView appView会调整大小.

我可以在启动时调整appView的大小;

super.init();

//re-configure appView layout
super.appView.setLayoutParams(new LinearLayout.LayoutParams(width,
height));
Run Code Online (Sandbox Code Playgroud)

但我不确定这是否是正确的方法,同样,我怎么能在运行时这样做呢?(webview应该是应用程序启动时的fill_parent)我假设我不能在运行时中期使用XML表来更改布局.PhoneGap库以编程方式处理所有布局,因此我应该将XML保留在其中.

此外,由于appView受到保护,除非我没有在我的活动中扩展DroidGap,否则很难玩这个:(

DroidGap.class

/*  184 */     this.root = new LinearLayoutSoftKeyboardDetect(this, width, height);
/*  185 */     this.root.setOrientation(1);
/*  186 */     this.root.setBackgroundColor(-16777216);
/*  187 */     this.root.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 0.0F));
Run Code Online (Sandbox Code Playgroud)

然后,

/*  208 */     this.appView = new WebView(this);
/*  209 */     this.appView.setId(100);
/*  211 */     this.appView.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 1.0F));
Run Code Online (Sandbox Code Playgroud)

和,

/*  249 */     bindBrowser(this.appView);
/*      */ 
/*  252 */     this.appView.setVisibility(4);
/*  253 */     this.root.addView(this.appView);
/*  254 */     setContentView(this.root);
Run Code Online (Sandbox Code Playgroud)

有任何想法吗??

我认为这对于想要在PhoneGap的webview上实现本机UI控件的任何人都很有用~~~~

*编辑

我能够强制相对布局到WebView appView的父级,这使我能够添加其他相关元素,然后我可以控制对齐...

与; - (onCreate)

// Initiate appView
super.init();

setContentView(R.layout.main);

// Re-configure appView layout by adding a RelativeLayout between root view and appView
RelativeLayout view = (RelativeLayout)findViewById(R.id.phonegap_container);
html = (View)super.appView.getParent();
html.setBackgroundColor(Color.RED);
view.addView(html, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
Run Code Online (Sandbox Code Playgroud)

当我的导航栏从底部动画时,我仍在寻找一些关于动画appView"up"的帮助......

HeW*_*cts 1

为什么不在你正在使用的应用程序中创建一个可以模仿滑块的 div 呢?

http://www.webresourcesdepot.com/sliding-top-menu-with-jquery/

或者你有理由在本地这样做吗?