這是我目前的ListView項目佈局:的RelativeLayout的TextView覆蓋
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="6dp"
android:paddingRight="6dp"
android:paddingBottom="6dp">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="6dp">
<TextView
android:id="@+id/departure_line"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:singleLine="true"
android:textSize="16sp"
android:textStyle="bold"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="1"
android:paddingLeft="3dp"
android:paddingRight="3dp" />
</RelativeLayout>
<TextView
android:id="@+id/departure_destination"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="52dp"
android:background="#777777"
android:singleLine="true"
android:ellipsize="end"
android:textSize="16sp" />
<TextView
android:id="@+id/departure_time"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:textSize="16sp" />
</RelativeLayout>
我的問題是目標的TextView覆蓋的時間TextView的,你可以在屏幕上看到。如何防止呢?
http://www.abload.de/image.php?img=screensk6y.png
要做到這一點的唯一方法是使用TableLayout,因爲RelativeLayout總是在佈局安排中覆蓋TextView。 – CannyDuck 2011-06-03 22:04:49
事實上,只要你使用佈局定義textView的邊緣,它就會隨時隨地走到你想要的位置,高度/寬度將停止在你告訴它的位置 – KyleM 2012-05-09 01:40:09
謝謝你的回答!對於在問題中包含工作「覆蓋」的問題提問者做得很好。這使得找到解決方案變得非常容易。 – 2012-06-20 16:44:40