Android 禁用淡入淡出边缘
我想完全禁用我的活动/应用程序顶部的淡入淡出边缘。我的视图仅包含以编程方式创建的 WebView:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
webView = new WebView(this);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.setVerticalFadingEdgeEnabled(false);
webView.setFadingEdgeLength(0);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(false);
webView.loadUrl("...");
setContentView(webView);
}
即使我已禁用淡入淡出边缘并将长度设置为 0,淡入淡出边缘在顶部(WebView 和 Android 状态栏之间)仍然可见。如果我在 WebView 顶部和 Android 状态栏之间添加了一些黑色空间,褪色边缘不再可见。
所以看起来淡入淡出的边缘是由活动本身添加的,而不是 WebView。有什么想法为什么会发生这种情况吗?是否有我错过的东西,或者有其他消除褪色边缘的方法?
I would like to completely disable the fading edge at the top of my activity/application. My view consists of only a WebView that is created programmatically:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
webView = new WebView(this);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.setVerticalFadingEdgeEnabled(false);
webView.setFadingEdgeLength(0);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(false);
webView.loadUrl("...");
setContentView(webView);
}
A fading edge is still visible at the top (between the WebView and the Android Status Bar), even though I've disabled the fading edge, and set the Length to 0. If I add some black space between the top of the WebView and the Android Status Bar, the fading edge is no longer visible.
So it seems like the fading edge is added by the activity itself, not the WebView. Any ideas why this is happening? Is there something I've missed, or some other way of removing the fading edge?
Similar: How to get rid of top fading edge in android full screen mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是您想要做的,将主题设置为全屏然后关闭全屏标志有点倒退,但它有效:)
Here is what you want to do, it's a bit backwards to set the theme to fullscreen and then turn of the fullscreen flag, but it works :)