[英]Android layout_below refuses to work with CheckBox
I have the following RelativeLayout
. 我有以下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>
I'm trying to place the CheckBox
below the TextView
using layout_below
attribute but it's not applying. 我正在尝试使用layout_below
属性将CheckBox
放置在TextView
下面,但未应用。 The layout_centerHorizontal
attrubute has an effect though. 虽然layout_centerHorizontal
属性有作用。 I think there is nothing wrong with the code but maybe there is. 我认为代码没有错,但也许有错。 Could you please point out what's wrong? 你能指出出什么问题吗?
in your TextBox you have this 在您的文本框中,您有这个
android="@+id/welcome"
you need this 你需要这个
android:id="@+id/welcome"
and in your CheckBox you need to use 在您的CheckBox中,您需要使用
android:layout_below="@+id/welcome"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.