【发布时间】:2017-11-06 04:19:47
【问题描述】:
我是新手,正在开发一个测验应用程序。底部有四个按钮。一切正常,但是当我在底部按钮放置横幅广告时无法正常工作。我想,我在错误的布局下放置横幅广告。请检查我的 xml 并建议我横幅广告的正确位置。谢谢。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:id="@+id/mainScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="com.myquiz.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerHorizontal="true">
</LinearLayout>
<LinearLayout
android:id="@+id/quizBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/header"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textColor="#dc143c"
android:background="@color/questionColor"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/question552"
android:textAppearance="@style/appearanceBody" />
<RadioGroup
android:id="@+id/group552"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp">
<RadioButton
android:id="@+id/answer552"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/question552A" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/question552B" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/question552C" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/question552D" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:id="@id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/quizBody"
android:orientation="horizontal">
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:background="@color/result"
android:onClick="getResults"
android:text="@string/resultButtonText" />
<Button
android:id="@+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginRight="5dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:background="@color/showanswers"
android:onClick="correctAnswers"
android:text="@string/showAnswersButtonText" />
<Button
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginRight="5dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:background="@color/ResetTest"
android:onClick="resetTest"
android:text="@string/resetButtonText" />
</LinearLayout>
<Button
android:id="@+id/model12expl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#87cefa"
android:layout_marginBottom="60dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_below="@id/button"
android:text="View Explanation" />
</RelativeLayout>
</ScrollView>
【问题讨论】:
标签: android layout admob banner