Android AdMob 廣告出現時會自動捲到底部

設定完 AdMob 後雖然正在瀏覽主要內容的區塊

但是當 廣告出現的時候
就會被自動捲到底部

我的 activity 中

外層是 scrollview

結構如下

[sourcecode language=”xml”]

<ScrollView>

<LinearLayout>
//主要內容
</LineadLayout>

<LinearLayout>
//AdMob layout
</LinearLayout>

</ScrollView>

[/sourcecode]

雖然正在瀏覽主要內容的區塊

但是當 廣告出現的時候
就會被自動捲到底部

最後是在 AdMob 的 LinearLayout 中加入下面這個屬性解決
android:descendantFocusability=”blocksDescendants”

完整

[sourcecode language=”xml”]

<ScrollView>

<LinearLayout>
//主要內容
</LineadLayout>

<LinearLayout
android:descendantFocusability="blocksDescendants"
>
//AdMob layout
</LinearLayout>

</ScrollView>

[/sourcecode]

資料來源:
http://stackoverflow.com/questions/9842494/how-to-prevent-a-scrollview-from-scrolling-to-a-webview-after-data-is-loaded

10 關於 “Android AdMob 廣告出現時會自動捲到底部” 的評論

  1. prolonged aluminize krugerrand seriality

    Μore thɑn tһat, sevеral popular brands, llike Wii սsing its Wiii Fit
    game, һave developeed games tһаt will get tһe viewer uⲣ and moving.
    Whеn a person hаs diabetes and hiɡh BP, the individuals risk оf developing cardiovascular diseases аlso doubles.

    Τһe rates of high blood pressure are two times ass fᥙll оf obese adults, as compared ѡith ѡhoever һas average ᧐r moderate weight.

    回覆
  2. Buy NBA 2K17 MT

    Cheap Aion EU Kinah Star Wars Battlefront 2 Credits are hot sale at gold.raiditem! Our professional team has over 10 years’ experience of selling MMORG currencies including wow gold for all the servers with competitive price, sacure&fast deliery,Aion EU Kinah, professional service! It is wise of you to buy Star W

    回覆
  3. odsylam do tej strony

    Excellent blog you have here but I was curious if you knew of any community forums that cover the same topics talked about here?
    I’d really like to be a part of online community where I can get advice from other knowledgeable
    people that share the same interest. If you have any recommendations, please
    let me know. Many thanks!

    回覆
  4. 訪客

    May I simply just say what a relief to uncover someone that actually understands what they’re
    discussing on the internet. You definitely know how to bring a problem to light and make it important.
    More people should check this out and understand
    this side of the story. I can’t believe you’re not more popular given that
    you definitely possess the gift.

    回覆
  5. acompanhante

    Há quanto tempo você já trabalha com weblog. Comecei faz um pouco mais de um
    mês e também vejo que é muito difícil achar matéria pra postar toda semana.

    回覆

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *