这是我的表格 -
<form name="clmbLead" id="clmbLead_{{FROM_ID}}" method="POST">
<input type="hidden" id="lineItem_{{FROM_ID}}">
<input type="hidden" id="ItemId_{{FROM_ID}}">
<div class="form_div"> <a href="javascript:void(0)" class="closeBtn" onclick="closeLeadfrm('{{FROM_ID}}')">x</a> <div class="form" id="form_{{FROM_ID}}">
<p>Submit your details in the form below:</p>
<div class="fild"><label for="name" >Name</label>
<input type="text" name="name" id="name_{{FROM_ID}}" placeholder="Name" onKeyPress="removeError(this.id)">
</div>
<div class="fild"><label for="mobile" >Mobile No.</label>
<input type="text" name="mobile" id="mobile_{{FROM_ID}}" maxlength="10" placeholder="Mobile No."onKeyPress="removeError(this.id)" >
</div>
<div class="fild"><label for="email" >Email ID</label>
<input style="width:261px" type="text" name="email" id="email_{{FROM_ID}}" placeholder="Email ID" onKeyPress="removeError(this.id)">
</div>
<br clear="all">
<div style="text-align:center">
<button class="submit_1" onclick="return
ReadLeads('{{FROM_ID}}')">Submit</button>
</div>
</div>
<div class="thanku-msg" id="thanku-msg_{{FROM_ID}}" style="display: none;">Thanks for sharing your Details!<br>We shall get back to you soon
</div>
</div>
</form>
form
正在webview
中正确加载。但是,如果我在form
上方添加以下样式,则它无效 -
<style>
.main_div {position: absolute; width: 100%;top: 0; left: 0; height: 100%;z-index: 9; margin-top:10px;overflow:hidden; }
.main_div .required { border-color:red !important; }
.main_div .form_div { background-color: #f5f5f5;border: 1px #dddddd solid;font: normal 14px arial; min-height: 250px;max-width: 500px;max-height: 250px;}
.main_div .form_div .form {width:92%;float: left;padding:10px 4%;}
.main_div .form_div .form .fild {width:50%;float: left;}
.formobile .form_div .form .fild {width:100%;}
.main_div .form_div .form .fild label {width: 100%;display: block;padding-bottom:3px;}
.formobile .form_div .form .fild label {display:none;}
.main_div .form_div .form .fild input {width:90%;padding:10px 0;margin-bottom:10px;padding-left:8px;border-radius:1px;border:1px #c1c1c1 solid;}
.formobile .form_div .form .fild input {width:100%;margin-bottom:15px;}
.main_div .form_div .form p {padding:0;margin:0;padding-bottom:10px;margin-bottom:10px;border-bottom:1px #dcdcdc solid;}
.formobile .form_div .form {padding-top:60px;padding-bottom: 20px;}
.formobile .form_div .form p {position: absolute;width:100%;left:0;top:0;padding: 10px 0;background-color:#EAEAEA;}
.formobile .form_div .form p::before {margin-left:10px;content: ""}
.main_div .form_div .form button.submit_1{padding:10px 30px;background-color:#e52b02;border:none;border-radius:5px;color: #FFFFFF;font:normal 15px arial;cursor: pointer;} .main_div .form_div .closeBtn {text-decoration: none;font: bold 20px arial;color: #000;right: 0;padding: 5px 10px;} .formobile .form_div .closeBtn {background-color:#EAEAEA;background-color: #DDDDDD;padding: 7px 15px;border-left:1px #D3D3D3 solid;}
.main_div .form_div .thanku-msg {position: absolute;margin:auto;left:0;right:0;top:0;bottom:0;width: 250px;height: 50px;text-align: center;}
.callLdForm {width: 81px; font: normal 11px arial; text-decoration: none; color: #353535; text-align: center; display: block; padding: 2px 0;background-color: rgba(0,0,0,0.2); border: 1px #A9A6A6 solid;border-radius: 3px;}
</style>
<div class="main_div" id="Lead_Frm_{{FROM_ID}}">
我尝试将此样式放在 CSS 文件中并添加该CSS文件。但那也行不通。 请建议如何使这种风格有效。
WebView代码(我尝试过内容和文件两种方式) -
browser = new WebView(this);
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
setContentView(browser,lp);
browser.getSettings().setJavaScriptEnabled(true);
browser.addJavascriptInterface(new abcInterface(this), "abc");
//put as content
browser.loadData(content, "text/html", "UTF-8");
//or put as html file
browser.loadUrl("file:///storage/emulated/0/dummy6.html");
答案 0 :(得分:1)
css / style 需要花费太多时间才能加载。
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
setContentView(browser,lp);
它们在style
或body
中没有宽度和高度参数,因此此代码将webview宽度和高度设置为0,加载的数据变为不可见。
设置固定的宽度和高度layoutparam,它变得可见。