0

我试图只制作一个小应用程序,但它的布局文件有问题。

在我将广告放入代码后,我的布局和背景都发生了变化。编辑文本下降了,两个按钮也下降了。我不知道如何使我的布局在广告放置后也一样。你能帮我吗?

Here's the code:

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

 <RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
<com.google.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adSize="BANNER"
    ads:adUnitId="MY_AD_ID"
    android:layout_alignParentTop="true"
    />


  <EditText 
    android:id="@+id/et_text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="135dp"
    />


 <RelativeLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

 <Button
    android:text="Send"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/btn_post"
    android:layout_gravity="right"
    android:layout_alignParentRight="true"/>

 <Button 
    android:text="Clear"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/btn_clear"/>
 </RelativeLayout>  
 </LinearLayout>

更新:现在我可以解决布局下降的问题,但我不知道如何制作我的应用程序,如果我点击编辑文本,键盘就会出现,而不是推开背景。感谢帮助!

4

2 回答 2

1

你还没有关闭你的第一个 RelativeLayout

  </RelativeLayout>  
于 2012-05-05T11:19:03.757 回答
0

如果您不希望它发生,请将 admob 放在应用程序的末尾。

于 2012-05-05T11:22:38.260 回答