android:layout“alignParentBottom=”;“真的”;无法将admob添加到底部
我有一个admob,3个TextView和一个admob。最后一个我想放在我活动的底部。它现在位于最后一个文本视图之后。有什么想法吗?我应该改变什么以将admob放在底部?(不是在最后一个文本视图之后)android:layout“alignParentBottom=”;“真的”;无法将admob添加到底部,android,android-xml,Android,Android Xml,我有一个admob,3个TextView和一个admob。最后一个我想放在我活动的底部。它现在位于最后一个文本视图之后。有什么想法吗?我应该改变什么以将admob放在底部?(不是在最后一个文本视图之后) 为什么底部不工作?admob位于不在底部的最后一个文本视图之后?因为您将相对版面的高度设置为“包裹内容”, 您应该将其更改为与父项匹配,这样它将起作用 因为您将相对布局的高度设置为包裹内容, 您应该将其更改为与父项匹配,这样它将起作用 试试下面的代码行 <?xml version="1
为什么底部不工作?admob位于不在底部的最后一个文本视图之后?因为您将相对版面的高度设置为“包裹内容”,
您应该将其更改为与父项匹配,这样它将起作用 因为您将相对布局的高度设置为包裹内容, 您应该将其更改为与父项匹配,这样它将起作用 试试下面的代码行
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ad_view"
android:layout_marginBottom="0dp"
android:layout_marginEnd="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:orientation="horizontal">
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-1234567">
</com.google.android.gms.ads.AdView>
</LinearLayout>
<TextView
android:id="@+id/howTo1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ad_view"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:onClick="onClick"
android:clickable="true"
android:text="1) Steep 1" />
<TextView
android:id="@+id/howTo2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/howTo1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:onClick="onClick"
android:clickable="true"
android:text="2) Steep 2" />
<TextView
android:id="@+id/howTo3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/howTo2"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:onClick="onClick"
android:clickable="true"
android:text="3) Steep 3" />
</RelativeLayout>
</ScrollView>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
ads:adSize="SMART_BANNER"
android:layout_alignParentBottom="true"
ads:adUnitId="ca-app-pub-1234567">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
尝试下面的代码行
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ad_view"
android:layout_marginBottom="0dp"
android:layout_marginEnd="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:orientation="horizontal">
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-1234567">
</com.google.android.gms.ads.AdView>
</LinearLayout>
<TextView
android:id="@+id/howTo1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ad_view"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:onClick="onClick"
android:clickable="true"
android:text="1) Steep 1" />
<TextView
android:id="@+id/howTo2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/howTo1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:onClick="onClick"
android:clickable="true"
android:text="2) Steep 2" />
<TextView
android:id="@+id/howTo3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/howTo2"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:onClick="onClick"
android:clickable="true"
android:text="3) Steep 3" />
</RelativeLayout>
</ScrollView>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
ads:adSize="SMART_BANNER"
android:layout_alignParentBottom="true"
ads:adUnitId="ca-app-pub-1234567">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
谢谢您的回答!我更改了它,但是现在我得到了一个关于xml的警告:这个亲戚应该使用wrap_内容。它不在底部:(谢谢你的回答!我更改了它,但是现在我得到了一个关于xml的警告:这个亲戚应该使用wrap_内容。它不在底部:(从scrollview中尝试adview。将相对布局作为父布局。@不使用scrollview的Reena可以工作。从scrollview中尝试adview。将相对布局作为父布局。@不使用scrollview的Reena可以工作。然后接受答案:)然后接受答案:)