我已经能够让广告出现在我的xml布局中的代码,但有一个问题。代码确实按预期构建和执行,但在xml编辑器中,布局被如下错误阻塞:
渲染问题无法实例化以下类:- com.amazon.device.ads.AdLayout (Open Class,显示异常)提示:在自定义视图中使用View.isInEditMode()可以跳过代码或显示示例数据,这些异常详细信息显示在android.os.Environment.getExternalStorageState com.amazon.device.ads.DebugProperties.readDebugProperties(DebugProperties.java:75)的com.amazon.device.ads.InternalAdRegistration.(InternalAdRegistration.java:52) com.amazon.device.ads.InternalAdRegistration.(InternalAdRegistration.java:48)的IDE Exception Details java.lang.NullPointerException中。(AdLayout.java:186)在com.amazon.device.ads.AdLayout.initialize(AdLayout.java:177) AdLayout.java:186工作...
这是我的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"
android:background="@drawable/background5"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:id="@+id/MainLayout"
tools:context=".MainActivity">
//start button
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Start"
android:background="#19d2b2"
android:id="@+id/start_button"
android:layout_above="@+id/instructions_button5"
android:layout_centerHorizontal="true"/>
//Instructions button
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Instructions"
android:background="#19d2b2"
android:id="@+id/instructions_button6"
android:layout_below="@+id/start_button"
android:layout_alignLeft="@+id/start_button"
android:layout_marginTop="10dp"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Gallery"
android:background="#19d2b2"
android:id="@+id/save_button"
android:layout_below="@+id/instructions_button6"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Scores"
android:id="@+id/Scores"
android:background="#19d2b2"
android:layout_below="@+id/save_button"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"/>
<com.amazon.device.ads.AdLayout
android:id="@+id/adview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="500dp"/>
有没有人知道有没有解决这个问题的方法,或者有更多关于什么可能导致这个问题的信息?
发布于 2015-07-09 03:06:13
同样的事情也发生在我身上。xml设计编辑器应该向您展示布局的外观。尝试模拟您的应用程序或将其连接到实际设备。它应该还能工作。但是,对于带有ad-view的布局,您总是会遇到渲染问题。
https://stackoverflow.com/questions/17933209
复制相似问题