小さなアプリケーションだけを作ろうとしましたが、レイアウト ファイルに問題があります。
コードに広告を配置した後、レイアウトがシフトされ、背景もシフトされました。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>
更新:これで、レイアウトが下がる問題を解決できましたが、アプリを作成する方法がわかりません。編集テキストをクリックすると、背景を押しのけずにキーボードが表示されます。手伝ってくれてありがとう!