Android 安卓:我需要安排我的应用程序的布局

Android 安卓:我需要安排我的应用程序的布局,android,layout,webview,Android,Layout,Webview,我用eclipse制作了我的第一个Android应用程序。现在我需要安排版面,因为我的版面现在在主要内容上,在WebView上显示Google AdMob广告。另外,当我旋转手机进入横向模式时,AdMob广告只出现在屏幕的一半。我如何解决这个问题,如何让Google AdMob拥有自己的空间,就像progressbar一样,而不是在WebView上显示。这是我的布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xm

我用eclipse制作了我的第一个Android应用程序。现在我需要安排版面,因为我的版面现在在主要内容上,在WebView上显示Google AdMob广告。另外,当我旋转手机进入横向模式时,AdMob广告只出现在屏幕的一半。我如何解决这个问题,如何让Google AdMob拥有自己的空间,就像progressbar一样,而不是在WebView上显示。这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<ProgressBar
android:id="@+id/web_view_progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="15dip"
android:padding="2dip"
android:progressDrawable="@drawable/colorprogress" />

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<ImageView
android:id="@+id/splash_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/desc"
android:scaleType="fitXY"
android:src="@drawable/splash"
android:visibility="visible" />

<WebView android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:visibility="gone" />

<com.google.ads.AdView android:id="@+id/adView"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   ads:adUnitId="a1500108406597c"
   ads:adSize="BANNER"
   ads:loadAdsOnCreate="true"
   android:layout_alignParentBottom="true"/>

</RelativeLayout>
</LinearLayout>

您已将
AdView
放在
相对视图
中,它将放在其中项目的顶部

您只想将其放在
线性布局中
;我已经向您展示了如果您想在
ProgressBar
RelativeLayout
之间使用它,您必须执行的操作:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

    <ProgressBar
    android:id="@+id/web_view_progress_bar"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="fill_parent"
    android:layout_height="15dip"
    android:padding="2dip"
    android:progressDrawable="@drawable/colorprogress" />

    <com.google.ads.AdView android:id="@+id/adView"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       ads:adUnitId="a1500108406597c"
       ads:adSize="BANNER"
       ads:loadAdsOnCreate="true"
       android:layout_alignParentBottom="true"/>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

        <ImageView
        android:id="@+id/splash_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="@string/desc"
        android:scaleType="fitXY"
        android:src="@drawable/splash"
        android:visibility="visible" />

        <WebView android:id="@+id/web_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none"
        android:visibility="gone" />

    </RelativeLayout>
</LinearLayout>


当然,如果您想将其放在底部,请将其放在标签上方。

谢谢您的回复。我把admob代码放在上面,但是现在广告不会出现了。我不知道哪里出了问题!?这可能是因为
相对长度
填充\u父项的高度存在干扰。您可能必须将其设置为
0
,并使用
1
作为权重。