【问题标题】:put imageview over the webview in android将imageview放在android中的webview上
【发布时间】:2014-02-24 06:17:39
【问题描述】:

我在开发时遇到了一个问题。

我的 XML 文件数据: 我在 xml 文件的 fill_parent 中使用了一个 webview,并且我使用了图像视图,底部布局我使用的是下一个和上一个按钮的按钮。

我的问题是我不会触摸 webview 内容,只想触摸图像视图内容,但是当我触摸图像视图内容时,webview 内容滚动,我不知道为什么?你能区分这个视图吗?

<?xml version="1.0" encoding="utf-8"?>
  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" >

    <ImageView 
    android:id="@+id/tv1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/transparent"/>



<android.webkit.WebView
    android:id="@+id/webView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/tv1"
    android:scrollbars="none">
</android.webkit.WebView>

</RelativeLayout>`

提前感谢您的建议....

【问题讨论】:

  • 以您想要的方式准确显示您的图像快照?
  • 更改 Webview 和 Imageview 的位置,即在您的布局中先添加 Webview 然后添加 Imageview
  • 我不想触摸 webview 内容。我只想触摸 imageview 内容。我该怎么办?

标签: android android-layout webview


【解决方案1】:

请颠倒查看顺序。即 Webview 之后的 ImageView

【讨论】:

  • 这不是你的答案。这一定是评论!!所以请熟悉这个..
  • 我按照你说的做了,但我没有得到结果。再次触摸 webview 内容..
  • 试试 android:focusable="false"
【解决方案2】:

像这样更改布局或使用Framelayout 而不是在webview 之上添加Imageview

<?xml version="1.0" encoding="utf-8"?>
  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" >
   <android.webkit.WebView
    android:id="@+id/webView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/tv1"
    android:scrollbars="none">
 <ImageView 
    android:id="@+id/tv1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/transparent"/>
</android.webkit.WebView>
</RelativeLayout>`

【讨论】:

    猜你喜欢
    • 2015-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-28
    • 1970-01-01
    • 2021-10-31
    相关资源
    最近更新 更多