我的布局包含ScrollView
,LinearLayout
(适用于屏幕较小的设备),但是当我放置AD
时我在屏幕上看不到它。在layout
(来自Android Studio)中,我在设备屏幕上看不到我的AD
。
你能帮我解决一下吗?
谢谢:)
<LinearLayout 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:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<!-- Login progress -->
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="1dp"
android:hint="@string/connect_id"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/connectbutton"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/connect_button"
android:textStyle="bold" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:text="@string/connect_tutorial_id_title"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_tutorial_id_content" />
</LinearLayout>
</ScrollView>
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adViewLandingPage"
android:layout_width="match_parent"
android:layout_height="39dp"
android:layout_gravity="bottom"
android:gravity="bottom"
ads:adSize="BANNER"
ads:adUnitId="@string/pub_connect" />
</LinearLayout>
我认为这不是我的Java代码:
mAdView = (AdView) findViewById(R.id.adViewLandingPage);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("XX")
.build();
mAdView.loadAd(adRequest);
答案 0 :(得分:3)
您的ScrollView有:
android:layout_width="match_parent"
android:layout_height="match_parent"
涵盖了您的广告。要解决此问题,请将ScrollView标记更改为:
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">