我想在包含文本的textview下面用数字定位我的textview。 我用这个布局和textviews重叠:在相对布局下在另一个textView下定位textView的问题
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/back"
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- we include header -->
<include
layout="@layout/header"/>
<Spinner
android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dip"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:textColor="#ffffff"
android:background="@drawable/spin" />
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000">
<TextView
android:id="@+id/tv1"
android:text="Some text to display:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="10dip"
android:textColor="#ffffff" />
<TextView
android:id="@+id/number"
android:text="123 456 789"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="30dip"
android:layout_marginTop="10dip"
android:textColor="#ffffcc"/>
</RelativeLayout>
</LinearLayout>
我所得到的这个是:
嘿,只是让你知道“@ + id”的符号将一个新的ID字符串添加到R.java文件中。如果TextView已经有一个id,你应该省略“+”字符。 – 2012-04-19 11:22:44
确实。我现在将执行13个月的编辑! – Blumer 2012-04-19 22:54:23
13个月了,你的代码还在,正在被像我这样的人阅读! :) – 2012-04-20 08:25:06