0

小さなアプリケーションだけを作ろうとしましたが、レイアウト ファイルに問題があります。

コードに広告を配置した後、レイアウトがシフトされ、背景もシフトされました。edittext が下がり、2 つのボタンも下がりました。広告を掲載した後もレイアウトを同じにする方法がわかりません。これで私を助けてもらえますか?

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 に答える