如上圖所示,這是我對他們幾個的一些複選標記的自定義列表視圖。基本上有兩個textview和一個imageview。我的問題是每當上方文本視圖中的文本很大時,圖像視圖就會脫離屏幕並且不顯示覆選標記。
我希望上層文本視圖的寬度應根據文本的長度進行擴展,但不應隱藏複選標記。
任何幫助欣賞。
編輯:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="6dip"
android:background="@color/black">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip"
android:id="@+id/row_image"/>
<ImageView
android:id="@+id/multiselect_icon"
android:src="@drawable/singlecheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/row_image"
android:visibility="gone"/>
<TextView
android:id="@+id/top_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/multiselect_icon"
android:layout_alignParentTop="false"
android:layout_alignParentRight="false"
android:textStyle="bold"
android:layout_weight="1"
android:textColor="@color/white"/>
<ImageView
android:id="@+id/shared_icon"
android:src="@drawable/sharedcheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/top_view"
android:visibility="gone"/>
<TextView
android:id="@+id/bottom_view_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="false"
android:layout_alignParentLeft="false"
android:layout_below="@id/top_view"
android:layout_toRightOf="@id/multiselect_icon"
android:gravity="left"
android:textColor="@color/lightGray"
android:visibility="gone"/>
<TextView
android:id="@+id/bottom_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_below="@id/top_view"
android:gravity="right"
android:textColor="@color/lightGray"/>
</RelativeLayout>
但是,這使共享檢查圖像保持對齊,不是嗎? – monchote
@monchote是的,它的確如此。但至少它總是可見的。我嘗試使用權重來達到上面的效果,但是沒有通過。如果你能提供任何東西,我會很感激。 –