csh_34 2013-07-30 08:17 采纳率: 0%
浏览 2128

如何在两个 views 之间放置 ad-view?

在一个 adview 中需要放置在两个 imageview 之间。
Layout如下:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@color/white" >       

    <ImageView
        android:id="@+id/back"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"            
        android:layout_marginLeft="5dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/backwonde"
        android:contentDescription="@string/app_name"
        android:onClick="listt" />

    <ImageView
        android:id="@+id/previous"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"            
        android:layout_marginRight="45dp"
        android:layout_marginTop="10dp"
        android:contentDescription="@string/app_name"
        android:onClick="previous"
        android:src="@drawable/left" />

    <ImageView
        android:id="@+id/next"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"            
        android:layout_alignParentRight="true"
        android:layout_marginRight="5dp"
        android:layout_marginTop="10dp"
        android:contentDescription="@string/app_name"
        android:onClick="next"
        android:src="@drawable/right" />

     <com.google.ads.AdView
        android:id="@+id/adView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/next"
        ads:adSize="BANNER"
        ads:adUnitId="MY PUB ID"
        ads:loadAdOnCreate="true" />

    <ImageView
        android:id="@+id/imm"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/list"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="30dp"
        android:contentDescription="@string/app_name" />

    <ImageView
        android:id="@+id/imm2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imm"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:contentDescription="@string/app_name" />

    <TextView
        android:id="@+id/stext1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imm2"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="30dp"
        android:text="@string/Tit"
        android:textColor="@color/DodgerBlue"
        android:textSize="18dp"
        android:textStyle="bold"
        android:typeface="sans" />

    <TextView
        android:id="@+id/dtext1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/stext1"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:lineSpacingExtra="0.1dp"
        android:textColor="@color/black"
        android:textSize="15dp"
        android:textStyle="normal"
        android:typeface="serif" />

    <TextView
        android:id="@+id/stext2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/dtext1"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:text="@string/loc"
        android:textColor="@color/DodgerBlue"
        android:textSize="18dp"
        android:textStyle="bold"
        android:typeface="sans" />

    <TextView
        android:id="@+id/dtext2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/stext2"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:lineSpacingExtra="0.1dp"
        android:textColor="@color/black"
        android:textSize="15dp"
        android:textStyle="normal"
        android:typeface="serif" />

    <TextView
        android:id="@+id/stext3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/dtext2"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:text="@string/hist"
        android:textColor="@color/DodgerBlue"
        android:textSize="18dp"
        android:textStyle="bold"
        android:typeface="sans" />

    <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/stext3"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="6dp"
        android:background="@color/white" />
</RelativeLayout>

我要把ad 放置在 Imageview的 "next" 和 "imm"之间。我尝试使用attribute layout,但是给出circular dependency error错误。如何实现这个功能?

  • 写回答

1条回答

  • JaveZh 2013-07-31 01:11
    关注

    出现循环依赖了,你看看是否哪两个控件相互写了相对的条件

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序