2013-04-06 97 views
0

我開發了一個應用程序(即當前在玩谷歌),並把廣告出錯。Android中的廣告問題

我把截圖給你一個想法。

1º啓動應用程序和廣告是正常的,當在EditText(文本)上按下是正常的,通常會停止寫入。

1º--- http://i.stack.imgur.com/7VTgL.png

問題是,當我切換活動或廣告再次訪問,並擊中了一樣的EditText(文本)被封鎖的廣告,因爲這並EditText上停留在現場。 ! [廣告現在上升,而不是eddittext] [3]

http://i.stack.imgur.com/j35Nw.png

這裏我XML活動:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".MainActivity" > 

    <ImageView 
     android:id="@+id/Biniciar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/Etitulo" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="36dp" 
     android:src="@drawable/micro" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/ETexto" 
     android:layout_alignBottom="@+id/ETexto" 
     android:layout_alignRight="@+id/textView1" 
     android:text="@string/Texto" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:id="@+id/anuncio" 
     android:layout_width="match_parent" 
     android:layout_height="60dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:background="#FFFFFF" > 
    </LinearLayout> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBottom="@+id/Etitulo" 
     android:text="@string/Titulo" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <Button 
     android:id="@+id/Bborrar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:text="@string/Limpiar" /> 

    <Button 
     android:id="@+id/BAdmin" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:text="@string/Notas" /> 

    <EditText 
     android:id="@+id/Etitulo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/Bborrar" 
     android:layout_marginTop="21dp" 
     android:layout_toRightOf="@+id/textView1" 
     android:ems="10" 
     android:inputType="text" > 

     <requestFocus /> 
    </EditText> 

    <Button 
     android:id="@+id/BGuardar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:text="@string/Guardar" /> 

    <EditText 
     android:id="@+id/ETexto" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/Etitulo" 
     android:layout_below="@+id/Biniciar" 
     android:layout_marginTop="31dp" 
     android:ems="10" 
     android:inputType="textMultiLine" 
     android:maxLines="5" /> 

</RelativeLayout> 
+0

你需要管理你的xml文件設計 – 2013-04-06 11:47:33

+0

你可以在這裏放置你的xml文件 – 2013-04-06 11:47:48

+0

當然,現在你可以看到我的XML,廣告是線性佈局「anuncio」。 Thx – CristianCV 2013-04-06 13:36:19

回答

0

你原來的佈局沒有鍵盤恰好與廣告,因爲剩下的工作您的內容不會填滿整個頁面。最好的做法是,除了將廣告對齊到底部外,還要告訴其餘的佈局放在廣告的旁邊。

<RelativeLayout> 
    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:id="@+id/anuncio" 
     android:layout_width="match_parent" 
     android:layout_height="60dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:background="#FFFFFF" > 
    </LinearLayout> 
    <RelativeLayout 
     android:id="@+id/restOfMyLayout" 
     android:layout_above="@id/anuncio"> 
     // Put the rest of your layout here. 
    </RelativeLayout> 
</RelativeLayout> 

如果您這樣做,廣告將不會覆蓋您的文本框。

+0

Thx,現在我有不同的佈局,但現在看起來像這樣,當我去做另一項活動並回來。現在一切都上升http://imgur.com/9IVkD9W – CristianCV 2013-04-07 10:37:05