Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
androidxml布局可以在横向环境下工作,但不能在正常方向上工作_Android_Xml_Android Layout_Admob_Landscape - Fatal编程技术网

androidxml布局可以在横向环境下工作,但不能在正常方向上工作

androidxml布局可以在横向环境下工作,但不能在正常方向上工作,android,xml,android-layout,admob,landscape,Android,Xml,Android Layout,Admob,Landscape,我试图显示一个Admob广告,但这只在横向模式下有效,而在正常模式下无效 layout land/main.xml和layout/main.xml是相同的!(好吧,现在是因为我删除了所有其他内容以查找bug) 从相对布局中删除填充。如果填充了祖先视图,AdMob就不能很好地发挥作用 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:myapp="http://schemas.a

我试图显示一个
Admob
广告,但这只在横向模式下有效,而在正常模式下无效

layout land/main.xml
layout/main.xml
是相同的!(好吧,现在是因为我删除了所有其他内容以查找bug)


从相对布局中删除填充。如果填充了祖先视图,AdMob就不能很好地发挥作用

 <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/test.testpkg"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    >


 <com.admob.android.ads.AdView
 android:id="@+id/ad" 
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent"
 myapp:backgroundColor="#000000"
 myapp:primaryTextColor="#FFFFFF"
 myapp:secondaryTextColor="#CCCCCC"
   />
</RelativeLayout>


问题出在哪里?异常、意外行为、布局问题……无异常,只是admob ap未以纵向显示。。只有在景观中我才能看到它。请尝试在您的AdView中设置android:background=“#ff0000”),以确保AdView本身是否显示。如果看到红色区域,则AdView的代码在纵向视图中的内容定位可能有问题。纵向:横向:确定AdView将在两个方向上显示。布局描述似乎是正确的。我想,视图的代码一定有问题。如何计算AdView内容的位置?也许你应该调试你的绘图方法。也许你有错误的边界,因此错误的中点,并把旗帜放在外面。。。
 <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/test.testpkg"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    >


 <com.admob.android.ads.AdView
 android:id="@+id/ad" 
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent"
 myapp:backgroundColor="#000000"
 myapp:primaryTextColor="#FFFFFF"
 myapp:secondaryTextColor="#CCCCCC"
   />
</RelativeLayout>