首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >单击AdMob广告后,我无法按后退按钮返回我的Android应用程序。

单击AdMob广告后,我无法按后退按钮返回我的Android应用程序。
EN

Stack Overflow用户
提问于 2013-12-18 16:33:13
回答 5查看 1.6K关注 0票数 2

我使用以下代码在我的应用程序中添加AdMob。

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="utf-8"?>
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >
<com.google.ads.AdView 
    android:id="@+id/adview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adSize="SMART_BANNER" 
    ads:adUnitId="ca-app-pub-*************************"
    ads:loadAdOnCreate="true"
    ads:testDevices="********************"
    />
 <TabHost
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        >

        <TabWidget
            android:id="@android:id/tabs"
            android:textSize="12sp"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
        </FrameLayout>
    </LinearLayout>
 </TabHost>
</LinearLayout>

广告显示在我的手机上。然而,当我点击“后退”按钮时,它不会返回到我的应用程序。相反,它返回到我以前看过的手机网页。欢迎任何建议。

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2013-12-31 18:03:11

请在你的舱单上试试这个。

代码语言:javascript
运行
复制
<activity android:name="com.google.ads.AdActivity"
     android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:noHistory="true">

尤其是“没有历史”。对我来说很管用。

票数 3
EN

Stack Overflow用户

发布于 2013-12-18 16:50:31

对我来说,这是预料中的行为,因为我偶尔也会发生这种事。一旦用户点击广告,后退按钮就会绑定到随后打开的应用程序上。它通常是谷歌游戏或你手机的浏览器。

在Google Play中,单击back通常会让您直接回到应用程序。然而,在您的浏览器中,按回将使您回到以前查看过的页面(就像在浏览器中按回),或者如果没有,则返回到您的应用程序。

一旦用户点击广告,控制后退按钮是你的手,真的。

票数 1
EN

Stack Overflow用户

发布于 2013-12-18 16:57:59

当点击admob广告时,整个互联网浏览器应用程序就会启动,而不仅仅是一个显示网页的活动。正如badgerati所说,这就是你的应用程序在互联网下面浏览的原因。为了突出这一问题,当你启动图片库应用程序来查看图片(从你的应用程序)时,只有Vies image活动启动,而不是整个大型应用程序,因此当您单击“后退”时,您返回到您的应用程序。但不幸的是,浏览器的情况并不相同。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20663480

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档