我试图在RelativeLayout
的TextView
以下定位图像,但它不起作用。当我使用android:layout_below
设置其位置时。这是我的xml如何在Android中以相对布局设置图像视图的位置?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#ccc"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/app_details_1"
android:text="@string/app_details_1"
android:textColor="#347"
android:gravity="center"
android:textSize="9pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ImageView
android:id="@+id/logo"
android:src="@drawable/secs"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_below="@+id/appdetails_1" <!-- I'm setting it here -->
/>
</RelativeLayout>
相反,它只是将图像放在屏幕的左上角。我如何定位?是layout_below
错误的定位码?
要完全解释这个:'+ id'是这个id必须被创建的一个快捷方式。引用现有的ID时,它只是'id'。有关此官方文档:http://developer.android.com/guide/topics/ui/declaring-layout.html#id – 2011-08-28 16:02:47
此外,错字'appdetails_1'而不是'app_details_1' – Ronnie
@ user7777777777是的,这是唯一的错误。加号不是错误。 – Michael