0

I am creating a webview app that has a splash screen load everytime the website is loading. I would like to make it that the logo is centered and above the progress bar always, regardless if the user rotates the screen or not. My problem is that everytime i get the position perfect on the veritical view, the progress bar will be ontop of the logo when u go to horizontal view. I would like the progress bar in the middle, and the logo about 20dp above the progress bar. Any help!! :) this is my code below:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:background="#ffffff"
a:gravity="top"
a:orientation="vertical" >

<WebView
a:id="@+id/webView1"
a:layout_width="fill_parent"
a:layout_height="fill_parent" />

<ImageView
a:id="@+id/imageView1"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layout_centerHorizontal="true"
a:layout_marginTop="50dp"
a:scaleType="centerInside"
a:src="@drawable/logo" />

<ProgressBar
a:id="@+id/progressBar1"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layout_alignTop="@drawable/logo"
a:layout_below="@drawable/logo"
a:layout_centerHorizontal="true"
a:layout_centerVertical="true" />

<Button
a:id="@+id/buttonBack"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layout_alignParentBottom="true"
a:layout_alignParentRight="true"
a:fadingEdge="horizontal|none"
a:onClick="backActivity"
a:text="Back" />

</RelativeLayout>
4

1 回答 1

0

当您尝试更改方向时,android 操作系统会重新启动活动。所以如果你想处理方向,你必须先检查方向。

这是一个示例代码..可能对您有帮助..

[Android中屏幕方向改变时切换布局][1]

http://www.southparksystems.com/devzilla/2010/3/3/switching-layouts-when-screen-orientation-changes-in-android.html

于 2012-11-26T04:54:27.823 回答