2011-07-16 99 views
1

我有一個RelativeLayout,裏面有一個WebView。放大和縮小後,我的WebView不在中心位置。當我將另一個視圖添加到我的RelativeLayout中時,我無法將WebView放置在中心位置。 任何人都可以請建議嗎? 任何幫助表示讚賞Android webview放大相對佈局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/fullscreen_image_parrent" 
android:orientation="vertical" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:background="@color/black"> 

<WebView 
    android:id="@+id/webview" 
    android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_centerInParent="true" 
android:layout_centerHorizontal="true" 
android:layout_centerVertical="true"> 
</WebView> 

<include layout="@layout/full_image_controls"/>  

+0

將fill_parent設置爲RelativeLayout,以及full_image_controls佈局中的內容,請先在此處放置full_image_controls佈局代碼。 –

回答

1

首先,你不需要orientation標籤中RelativeLayout。另一件事..你試着設置你的佈局的寬度和高度參數爲fill_parent。我並不確定,但在某些情況下,我的視圖中的對齊方式幾乎與我的視圖相同,因爲我的RelativeLayout使用的是wrap_content而不是fill_parent

+0

我已經失去了希望得到答案!在我進行縮放工作後,出現了一個奇怪的問題:縮放圖像時圖像有點跳躍。無論如何,非常感謝你) – superM