[英]Android layout_below refuses to work with CheckBox
我有以下RelativeLayout
。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android="@+id/welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:paddingTop="20dp"
android:text="@string/main" />
<CheckBox
android:id="@+id/startupopt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/welcome"
android:layout_centerHorizontal="true"
android:text="@string/startup"
android:onClick="checkboxClicked">
</CheckBox>
<ImageView
android:id="@+id/toggle_image"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerInParent="true" />
</RelativeLayout>
我正在嘗試使用layout_below
屬性將CheckBox
放置在TextView
下面,但未應用。 雖然layout_centerHorizontal
屬性有作用。 我認為代碼沒有錯,但也許有錯。 你能指出出什么問題嗎?
在您的文本框中,您有這個
android="@+id/welcome"
你需要這個
android:id="@+id/welcome"
在您的CheckBox中,您需要使用
android:layout_below="@+id/welcome"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.