我已经创建了一个活动并使用RelativeLayout
,它默认在Android Studio中提供。在relativeLayout中相互重叠的元素
我想在我的TextView
之前放置一个按钮,但我无法这样做。
下面是结果:
这里是我的代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MyActivity">
<TextView
android:id="@+id/heading"
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/button"
android:text="@string/sachin_jain"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignLeft="@+id/heading"
android:layout_alignTop="@+id/heading"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
看起来像我失去了一些东西。任何帮助,将不胜感激!!
的可能的复制[如何把在同一个xml布局中彼此之上的元素?](http://stackoverflow.com/questions/78883 37/how-to-put-elements-on-each-other-in-the-same-xml-layout) – Trilarion