2014-03-06 45 views
0

我想创建应该是这样的内容:我可以将WebView与ImageButton重叠吗?

enter image description here

我希望它喜欢这样,因为我希望按钮覆盖的WebView的内容使其无法到达用户的一部分。

+0

忽视的事实是,在该示例中的ImageButton比的WebView它可以在其上,只要它是重叠的WebView – Shishi

+0

什么是你想隐藏的底部低一点? – ksasq

+0

我的想法是覆盖YouTube媒体播放器最小化/全屏按钮,并将其替换为我自己的,但我仍在审阅另一个选项,我想用它覆盖整个带有黑色alpha图像的webview,并放置一个它上面的新webview显示图像的全尺寸。仍在尝试这些事情 – Shishi

回答

1

则可以使用FrameLayout如下操作

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <WebView 
     android:id="@+id/webview" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 

    <Button 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:text="Button" /> 

</FrameLayout> 
0

是可以do.for这个目的,你必须使用相对你有layout.first添加web视图,然后添加图片按钮,并设置重力底部到图像button.i认为这可以帮助你。

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

     <WebView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_marginBottom="20dp" 
      /> 
     <ImageButton 
      android:layout_width="fill_parent" 
      android:layout_height="40dp" 
      android:background="@android:color/darker_gray" 
      android:layout_alignParentBottom="true" 
      /> 
    </RelativeLayout>