我正在尝试构建一个“行”以在我的应用程序中使用。
在“行”中,我使用两个视图来创建一个水平条。
这是 XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="horizontal" >
<TextView
android:id="@+id/eventname"
style="@style/T2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="nome evento" >
</TextView>
<TextView
android:id="@+id/eventtype"
style="@style/S2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="tipo evento" />
<View
android:id="@+id/riga"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentTop="true"
android:background="#ffffff" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_above="@+id/riga"
android:background="@color/lines" />
</RelativeLayout>
这是我得到的结果:
到目前为止,一切都很好。
但是如果我把视图放在底部:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="horizontal" >
<TextView
android:id="@+id/eventname"
style="@style/T2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="nome evento" >
</TextView>
<TextView
android:id="@+id/eventtype"
style="@style/S2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="tipo evento" />
<View
android:id="@+id/riga"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#ffffff" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_above="@+id/riga"
android:background="@color/lines" />
</RelativeLayout>
这是我得到的结果
请问这个怎么解决????
谢谢!!!