OnTouch 是否有视图占用 GONE 视图空间?
我有一个网络视图和一个广告视图,当我单击网络视图中的某个项目时,我想隐藏广告视图并使网络视图占据全屏。我隐藏了广告视图,但随后我的网络视图实际上缩小了一些。所以我想设置它,以便当我单击该项目时它会全屏显示。我尝试在触摸事件中使用以下内容,但它只会使应用程序崩溃。
webview.setLayoutParams(newLayoutParams(Gravity.FILL,LayoutParams.WRAP_CONTENT));
任何帮助将不胜感激。
I have a webview and a adview and when I click on an item in the webview I want to hide the adview and make the webview take up the full screen. I have the adview being hidden but then my webview actually shrinks some. So I want to set it so it goes full screen when I click the item. I tried using the following in the on touch event but it just crashes the app.
webview.setLayoutParams(newLayoutParams(Gravity.FILL,LayoutParams.WRAP_CONTENT));
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不尝试类似的东西
这应该刷新您的视图。
Why not try with something like
This should refresh your view.
请参考 Ashish 答案,
最好在 FrameLayout 中添加这些视图
,这样两个视图都不会占用彼此的空间
,然后使用
adView.setVisibility(View.GONE)
Please refer Ashish answer with this
it will be better to add these views in FrameLayout
so that none of the both views will take space of each other
and then use
adView.setVisibility(View.GONE)