【发布时间】:2012-10-29 17:12:01
【问题描述】:
我有下一个问题:我经常使用 RelativeLayout,就像 Android 文档告诉我的那样。但是,几天后,我不明白为什么,这不再起作用了:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/background"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/boton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Button" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/boton"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000" />
</RelativeLayout>
这是我的布局,很简单。因此,根据这一点,textView 应该在按钮下方,但是,它却出现在按钮上方!
.
有人解释一下会发生什么吗?
编辑:问题不在于我尝试在设备上运行它,而是当我在 ADT Plugin for Eclipse 的图形布局上看到它时出现问题......
【问题讨论】:
-
你结束了你的
RelativeLayout,你的代码对我有用。</RelativeLayout> -
你的代码对我来说也很好用。你是否像 Asok 所说的那样结束了相对布局标签
-
工作正常关闭相关布局标签。
-
请记住,如果您的 xml 文件有错误导致无法正确构建,那么它将显示上次正常工作的预览。
-
问题是不在设备上运行它......问题出现在Eclipse上ADT插件的图形布局上。