Android SDK图像视图浮动在webview上方

时间:2013-02-28 20:39:02

标签: android sdk

你添加到xml文件的所有内容是为了让imageview浮动在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>

1 个答案:

答案 0 :(得分: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>