问题在于我无法在adslayout中添加ad @ m ad。 我想在每个屏幕上展示广告@ m广告。 如果我把代码放在那里
你能帮帮我吗?非常感谢提前! :)
这是我的代码。
main.xml中
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Framelayout to display Fragments -->
<RelativeLayout
android:id="@+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<net.daum.adam.publisher.AdView
android:id="@+id/adview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
clientId="test"
requestInterval="60"
android:visibility="invisible" />
</RelativeLayout>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" />
<!-- Listview to display slider menu -->
</android.support.v4.widget.DrawerLayout>
这是错误信息。
04-02 15:06:08.470: E/AndroidRuntime(12242): FATAL EXCEPTION: main
04-02 15:06:08.470: E/AndroidRuntime(12242): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Moumi_Social/com.Moumi_Social.MainActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class net.daum.adam.publisher.AdView
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.ActivityThread.access$700(ActivityThread.java:143)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.os.Looper.loop(Looper.java:137)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.ActivityThread.main(ActivityThread.java:4950)
04-02 15:06:08.470: E/AndroidRuntime(12242): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 15:06:08.470: E/AndroidRuntime(12242): at java.lang.reflect.Method.invoke(Method.java:511)
04-02 15:06:08.470: E/AndroidRuntime(12242): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:997)
04-02 15:06:08.470: E/AndroidRuntime(12242): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764)
04-02 15:06:08.470: E/AndroidRuntime(12242): at dalvik.system.NativeStart.main(Native Method)
04-02 15:06:08.470: E/AndroidRuntime(12242): Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class net.daum.adam.publisher.AdView
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
04-02 15:06:08.470: E/AndroidRuntime(12242): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.Activity.setContentView(Activity.java:1915)
04-02 15:06:08.470: E/AndroidRuntime(12242): at com.Moumi_Social.MainActivity.onCreate(MainActivity.java:81)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.Activity.performCreate(Activity.java:5177)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
04-02 15:06:08.470: E/AndroidRuntime(12242): ... 11 more
04-02 15:06:08.470: E/AndroidRuntime(12242): Caused by: java.lang.ClassNotFoundException: net.daum.adam.publisher.AdView
04-02 15:06:08.470: E/AndroidRuntime(12242): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
04-02 15:06:08.470: E/AndroidRuntime(12242): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
04-02 15:06:08.470: E/AndroidRuntime(12242): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
04-02 15:06:08.470: E/AndroidRuntime(12242): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
04-02 15:06:08.470: E/AndroidRuntime(12242): ... 22 more