I have a RelativeLayout and there is a WebView inside it. After I zoom in and zoom out, my WebView isn’t in center. When I include another view into my RelativeLayout I can’t place the WebView in center.
Can anyone please suggest anything??
any help is appreciated
<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"/>
First of all, you don’t need
orientationtag inRelativeLayout. And another thing..did you try to set your layout width and height params tofill_parent. I’m not really sure about it,but in some situations I had almost the same problem with alignments on my views just because myRelativeLayoutwas usingwrap_contentinstead offill_parent.