2014-03-06 122 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>