방금 내 레이아웃에 Adview를 포함하려고했습니다. 인터넷 연결이없는 경우 공백을 표시한다는 점을 제외하면 잘 작동합니다. 지금까지 읽은 것처럼, admob에 대한 표준 동작은 광고가 표시 될 때만 공간을 차지하는 것임을 이해합니다. 그렇지 않으면, 예. 인터넷에 연결되어 있지 않으면 레이아웃 공간이 없어야합니다. 나는 응용 프로그램 Gradle을에, 그리고 내가 실수를했을 수도와 나는이 이상한 행동을 발생하는 이유라고 생각 코드 ...Admob의 Adview는 인터넷에 연결되지 않은 경우 빈 상자를 표시합니다.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FFFFFF"
android:weightSum="1">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/AppTheme.AppBarOverlay"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<include layout="@layout/content_main"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
목록 해요 :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-ads:9.2.0'
}
apply plugin: 'com.google.gms.google-services'
그리고 모듈 Gradle을에 :
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
내가 잘못 생각한 것 같아서 조언을 해주십시오. 감사합니다.
상자는 어떤 경계 또는 단지 빈 영역을 가지고이 코드를 추가 하시겠습니까? – giannisf
테두리가 없거나 빈 영역이 ... – Rucsi
사용할 수없는 경우 인터넷 연결 및 숨기기를 확인하는 것이 좋습니다. – giannisf