添加admob小部件以隐藏按钮

Amandeep Singh |

我正在尝试将admob广告放在表格行内活动的底部。问题是当我添加admob小部件时未在其下方显示按钮。最初,当广告未加载时,它会显示按钮,但是一旦显示广告,该按钮就会消失。下面是代码:

<?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:id="@+id/outerlinearLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:fillViewport="true" >

        <LinearLayout
            android:id="@+id/linearLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TableLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >

                <TableRow
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/storycontentheader"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="2dip"
                        android:lineSpacingExtra="10dip"
                        android:text="Curteous Coutney Walsh gifts World Cup Final to Pakistan"
                        android:textColor="@android:color/black"
                        android:textSize="25dip"
                        android:textStyle="bold"
                        android:fontFamily="calibri"
                         />
                </TableRow>

                <TableRow
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/storycontentauthor"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="2dip"
                        android:text="Martin Arthur | 5 people voted this story\n"
                        android:textColor="@android:color/black"
                        android:textSize="12dip"
                        android:textStyle="bold" />
                </TableRow>

                <TableRow
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/storyTags"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="2dip"
                        android:text="Martin Arthur | 5 people voted this story\n"
                        android:textColor="@android:color/black"
                        android:textSize="12dip"
                        android:textStyle="bold" />
                </TableRow>

                <TableRow
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <ImageView
                        android:id="@+id/storyImage"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:src="@drawable/icon" />
                </TableRow>

                <TableRow
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/storycontent"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:lineSpacingExtra="10dip"
                        android:padding="10dip"
                        android:text="content"
                        android:textColor="@android:color/black"
                        android:fontFamily="calibri"
                        android:textSize="16dip" />
                </TableRow>
            </TableLayout>
        </LinearLayout>
    </ScrollView>

    <TableLayout
        android:id="@+id/footer_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
  <TableRow
            android:id="@+id/footer_tablerow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <com.google.ads.AdView
                android:id="@+id/adView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                ads:adSize="BANNER"
                ads:adUnitId="XXXXXXXXXX"
                ads:loadAdOnCreate="true" />
        </TableRow>
        <TableRow
            android:id="@+id/footer_tablerow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >


   <TextView
                        android:id="@+id/lastUpdated"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="2dip"
                        android:text="Martin Arthur | 5 people voted this story\n"
                        android:textColor="@android:color/white"
                        android:textSize="12dip"
                        android:layout_gravity="center"
                        android:textStyle="bold" />
            <Button
                android:id="@+id/back_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:text="Back"
                android:textColor="@android:color/background_light" />
        </TableRow>
    </TableLayout>

</LinearLayout>

消失的按钮是back_btn。你能帮我这个忙吗?

问候,Amandeep

哈里哈兰

试试这个..

<?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:id="@+id/outerlinearLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent".
    android:background="@drawable/background"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:fillViewport="true" >

        <LinearLayout
            android:id="@+id/linearLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/storycontentheader"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="calibri"
                android:lineSpacingExtra="10dip"
                android:padding="2dip"
                android:text="Curteous Coutney Walsh gifts World Cup Final to Pakistan"
                android:textColor="@android:color/black"
                android:textSize="25dip"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/storycontentauthor"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="2dip"
                android:text="Martin Arthur | 5 people voted this story\n"
                android:textColor="@android:color/black"
                android:textSize="12dip"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/storyTags"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="2dip"
                android:text="Martin Arthur | 5 people voted this story\n"
                android:textColor="@android:color/black"
                android:textSize="12dip"
                android:textStyle="bold" />

            <ImageView
                android:id="@+id/storyImage"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/icon" />

            <TextView
                android:id="@+id/storycontent"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="calibri"
                android:lineSpacingExtra="10dip"
                android:padding="10dip"
                android:text="content"
                android:textColor="@android:color/black"
                android:textSize="16dip" />
        </LinearLayout>
    </ScrollView>

    <com.google.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="XXXXXXXXXX"
        ads:loadAdOnCreate="true" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/lastUpdated"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:padding="2dip"
            android:text="Martin Arthur | 5 people voted this story\n"
            android:textColor="@android:color/white"
            android:textSize="12dip"
            android:textStyle="bold" />

        <Button
            android:id="@+id/back_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:text="Back"
            android:textColor="@android:color/background_light" />
    </LinearLayout>

</LinearLayout>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

热门隐藏小部件上的此按钮?

来自分类常见问题

按下按钮后添加卡片小部件

来自分类Dev

在卡片小部件中添加一个凸起按钮

来自分类Dev

按钮单击从API获取的添加下拉小部件

来自分类Dev

按下按钮后添加卡片小部件

来自分类Dev

按钮小部件添加新图块,而不是替换旧图块

来自分类Dev

如何向 roundSlider 小部件添加启用/禁用按钮?

来自分类Dev

Flutter:如何在包含其他类型窗口小部件的ListView.builder的末尾添加按钮窗口小部件?

来自分类Dev

获取按钮小部件的文本

来自分类Dev

如何在不禁用小部件的情况下禁用或隐藏jQuery UI微调器按钮?

来自分类Dev

在iOS10中的“今日”小部件中隐藏“显示更多”按钮

来自分类Dev

类似于Adblock的插件,用于隐藏社交网站的小部件,按钮等

来自分类Dev

如何在不禁用小部件的情况下禁用或隐藏jQuery UI微调器按钮?

来自分类Dev

在iOS10中的“今日”小部件中隐藏“显示更多”按钮

来自分类Dev

如何使用 python tkinter 中的复选按钮在 Entry 小部件中显示或隐藏文本?

来自分类Dev

PyQt5在每个选项卡旁边添加添加和删除小部件按钮

来自分类Dev

qmake不添加小部件

来自分类Dev

在kivy中添加小部件

来自分类Dev

保存添加的小部件的状态

来自分类Dev

在kivy中添加小部件

来自分类Dev

动态添加小部件python

来自分类Dev

Android,ActionBar隐藏其他小部件

来自分类Dev

根据x,y坐标隐藏小部件

来自分类Dev

Tkinter菜单小部件:隐藏菜单的命令

来自分类Dev

Django表单字段小部件被隐藏

来自分类Dev

隐藏/显示小部件的最佳方法

来自分类Dev

使用条件标签隐藏 wordpress 小部件

来自分类Dev

Android:在操作栏中向SearchView窗口小部件添加自定义按钮

来自分类Dev

创建选项卡并通过循环在每个选项卡中添加小部件+按钮

Related 相关文章

  1. 1

    热门隐藏小部件上的此按钮?

  2. 2

    按下按钮后添加卡片小部件

  3. 3

    在卡片小部件中添加一个凸起按钮

  4. 4

    按钮单击从API获取的添加下拉小部件

  5. 5

    按下按钮后添加卡片小部件

  6. 6

    按钮小部件添加新图块,而不是替换旧图块

  7. 7

    如何向 roundSlider 小部件添加启用/禁用按钮?

  8. 8

    Flutter:如何在包含其他类型窗口小部件的ListView.builder的末尾添加按钮窗口小部件?

  9. 9

    获取按钮小部件的文本

  10. 10

    如何在不禁用小部件的情况下禁用或隐藏jQuery UI微调器按钮?

  11. 11

    在iOS10中的“今日”小部件中隐藏“显示更多”按钮

  12. 12

    类似于Adblock的插件,用于隐藏社交网站的小部件,按钮等

  13. 13

    如何在不禁用小部件的情况下禁用或隐藏jQuery UI微调器按钮?

  14. 14

    在iOS10中的“今日”小部件中隐藏“显示更多”按钮

  15. 15

    如何使用 python tkinter 中的复选按钮在 Entry 小部件中显示或隐藏文本?

  16. 16

    PyQt5在每个选项卡旁边添加添加和删除小部件按钮

  17. 17

    qmake不添加小部件

  18. 18

    在kivy中添加小部件

  19. 19

    保存添加的小部件的状态

  20. 20

    在kivy中添加小部件

  21. 21

    动态添加小部件python

  22. 22

    Android,ActionBar隐藏其他小部件

  23. 23

    根据x,y坐标隐藏小部件

  24. 24

    Tkinter菜单小部件:隐藏菜单的命令

  25. 25

    Django表单字段小部件被隐藏

  26. 26

    隐藏/显示小部件的最佳方法

  27. 27

    使用条件标签隐藏 wordpress 小部件

  28. 28

    Android:在操作栏中向SearchView窗口小部件添加自定义按钮

  29. 29

    创建选项卡并通过循环在每个选项卡中添加小部件+按钮

热门标签

归档