2013-02-28 54 views
1

所有你添加到XML文件是什么,让一个ImageView的漂浮在网页视图或相机视图等Android SDK中的图像视图花车上面的WebView

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

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="wrap_content" 
    android:layout_height="40dp" 
    android:src="@drawable/pm" 
    /> 

<WebView 
    android:id="@+id/webView1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

</LinearLayout> 

回答

2

您需要使用不同的布局,如FrameLayoutRelativeLayout

<?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:background="#e2e1e3" > 

    <WebView 
     android:id="@+id/webView1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_centerInParent="true" /> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:src="@drawable/pm" 
     android:layout_centerInParent="true" /> 

</RelativeLayout> 
+0

多数民众赞成在造成它隐藏,当放在横向我想imageview漂浮在webview – MrJoshFisher 2013-02-28 20:58:27

+0

@ M0n5terBunny,我的错误。我只是做了一个编辑来改变z顺序。 – Phil 2013-02-28 21:07:31

+0

如何将图像放在左上角 – MrJoshFisher 2013-02-28 21:37:23