<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="600dip"
    android:layout_height="350dip"
    android:gravity="center"
    android:orientation="vertical" >    <WebView
        android:id="@+id/webview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />    <ImageButton
        android:id="@+id/imgbtn_close"
        android:layout_width="48dip"
        android:layout_height="48dip"
        android:background="@color/nd_gcsdk_transparent"
        android:padding="3dip"
        android:src="@drawable/cancelbtn" /></RelativeLayout>我这代码不管用...求高手请教

解决方案 »

  1.   

    RelativeLayout  里面怎么会有    android:orientation="vertical" 
     你外层得layout 不是全屏的webview是根据relativelayout居中
      

  2.   

    给webview加上这个
            android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
      

  3.   


    android:layout_centerInParent="true" 试一试 
      

  4.   

    android:layout_centerInParent="true"