修复三按键导航模式下,首页Banner进去可能网页底部显示不全的问题
This commit is contained in:
parent
d71fe7d92e
commit
08906e028a
@ -27,6 +27,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.utils.AndroidBug5497Workaround;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
@ -67,14 +68,13 @@ public class WebViewActivity extends AbsActivity {
|
||||
btnEdit = (ImageView) findViewById(R.id.btn_edit);
|
||||
ft_title = (FrameLayout) findViewById(R.id.ft_title);
|
||||
v_spacing = (View) findViewById(R.id.v_spacing);
|
||||
mWebView = findViewById(R.id.webView);
|
||||
AndroidBug5497Workaround.assistActivity(this);
|
||||
|
||||
mWebView = new WebView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
params.topMargin = DpUtil.dp2px(1);
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
rootView.addView(mWebView);
|
||||
// mWebView.setLayoutParams(params);
|
||||
//mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
@ -96,6 +96,9 @@ public class WebViewActivity extends AbsActivity {
|
||||
if (url.contains("for")) {
|
||||
mWebView.loadUrl("javascript:goAnchorTab()");
|
||||
}
|
||||
//屏幕高度-ft_title的paddingTop
|
||||
int height = DeviceUtils.getScreenHeight(mContext)-DpUtil.dp2px(24);
|
||||
view.loadUrl("javascript:window.androidObject.setHeight("+height+",0)");
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -484,7 +484,11 @@ public class JavascriptInterfaceUtils {
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.post(() -> {
|
||||
ViewGroup.LayoutParams params = mWebView.getLayoutParams();
|
||||
params.height = DpUtil.dp2px(Integer.parseInt(height));
|
||||
if("-1".equals(height)){
|
||||
params.height=ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
}else {
|
||||
params.height = Integer.parseInt(height);
|
||||
}
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
|
@ -63,4 +63,9 @@
|
||||
android:layout_height="3dp"
|
||||
android:progressDrawable="@drawable/bg_horizontal_progressbar"
|
||||
android:visibility="gone" />
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user