<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="18dip"
android:background="#00FF00"
android:text="文本内容"
android:gravity="center_vertical|center_horizontal"
/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18dip"
android:background="#FFFFFF"
android:textColor="#FF0000"
android:text="设置字符串显示为*"
android:gravity="center_vertical|center_horizontal"
/>
在运行之后第一个testview里面的“文本内容没有显示出来”,只显示了第二个testview里面的内容,知道是被覆盖了,但不知道如何修改,使两个testview里面的内容在两行显示
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView android:id="@+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="18dip"
android:background="#00FF00"
android:text="文本内容"
android:gravity="center_vertical|center_horizontal"
/>
<TextView android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_below="@+id/textView2"
android:textSize="18dip"
android:background="#FFFFFF"
android:textColor="#FF0000"
android:text="设置字符串显示为*"
android:gravity="center_vertical|center_horizontal"
/>
</RelativeLayout>
这两个TextView放在Framelayout里吗,相对布局或线性布局应该不会这样吧,新建了一个是这样的
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_below="@+id/textView2"
android:layout_marginTop="14dp"
android:text="TextView" />
</RelativeLayout>