[英]Android PhoneGap Plugin, UI tabbar, resize WebView
I am creating a tasty PhoneGap plugin that hopefully will be opened up once it is ready.. The plugin is mostly finished, I just need a nice UI for user interaction. 我正在创建一个美味的PhoneGap插件,希望它一旦准备好就会被打开..插件大部分都已完成,我只需要一个很好的UI用户交互。
In a nutshell I want to create a "native" android toolbar component. 简而言之,我想创建一个“原生”android工具栏组件。 Much how you would if you implement the PhoneGap UIControls Tabbar library for IOS by Decaf Ninja Software. 如果您通过Decaf Ninja Software为IOS实现PhoneGap UIControls Tabbar库,您将如何做。
Ideally; 理想的情况下;
I can resize the appView on launch with; 我可以在启动时调整appView的大小;
super.init();
//re-configure appView layout
super.appView.setLayoutParams(new LinearLayout.LayoutParams(width,
height));
But I am not sure if this is the right approach, also, how can I do this in runtime? 但我不确定这是否是正确的方法,同样,我怎么能在运行时这样做呢? (the webview should be fill_parent at app start) I assume I cannot use XML sheets for changing the layout in mid- runtime. (webview应该是应用程序启动时的fill_parent)我假设我不能在运行时中期使用XML表来更改布局。 The PhoneGap library handles all the layout programmatically so I should probably leave XML out of it. PhoneGap库以编程方式处理所有布局,因此我应该将XML保留在其中。
Also as the appView is protected it is very difficult to play with this unless I am not extending DroidGap in my activity :( 此外,由于appView受到保护,除非我没有在我的活动中扩展DroidGap,否则很难玩这个:(
DroidGap.class 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));
then, 然后,
/* 208 */ this.appView = new WebView(this);
/* 209 */ this.appView.setId(100);
/* 211 */ this.appView.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 1.0F));
and, 和,
/* 249 */ bindBrowser(this.appView);
/* */
/* 252 */ this.appView.setVisibility(4);
/* 253 */ this.root.addView(this.appView);
/* 254 */ setContentView(this.root);
Any Ideas?? 有任何想法吗??
I think this would be useful for anyone who wants to implement native UI controls on top of PhoneGap's webview~~~~ 我认为这对于想要在PhoneGap的webview上实现本机UI控件的任何人都很有用~~~~
* EDIT *编辑
I was able to force a relative layout to the parent of the WebView appView which enabled me to add other relative elements which I can then control the alignment... 我能够强制相对布局到WebView appView的父级,这使我能够添加其他相关元素,然后我可以控制对齐...
with;- (onCreate) 与; - (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));
I am still looking for some help on animating the appView "up" when my nav bar animates up from the bottom...... 当我的导航栏从底部动画时,我仍在寻找一些关于动画appView“up”的帮助......
Why don't you create a div in the app you are using, which can imitate a slider? 为什么不在你正在使用的app中创建一个div,它可以模仿一个滑块?
http://www.webresourcesdepot.com/sliding-top-menu-with-jquery/ http://www.webresourcesdepot.com/sliding-top-menu-with-jquery/
Or is there a reason for you to do it natively ? 或者你有理由本地做吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.