我必须设计一个列表项,并给出它内部组件的给定分布
我正在尝试使用相对布局,因为每个ImageView都是固定大小的,而TextView应该覆盖列表项中的剩余空间,其宽度为match_parent。 (欢迎任何更好的想法!)
所以我现在的代码是:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_margin="10dp"
android:layout_alignParentLeft="true"
android:src="@drawable/appcontrols_customerhistory_operation"
android:id="@+id/operationsDoneOperationIcon" />
<ImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentRight="true"
android:layout_margin="10dp"
android:src="@drawable/appcontrols_customerhistory_operation"
android:id="@+id/operationsDoneChevronIcon" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="10dp"
android:layout_toLeftOf="@id/operationsDoneChevronIcon"
android:src="@drawable/appcontrols_customerhistory_operation"
android:id="@+id/operationsDoneStatusIcon" />
<TextView
android:id="@+id/operationsAvailableItemName"
android:textAppearance="@style/TextAppearanceSmall"
android:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
android:maxLines="4"
android:lines="4"
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/operationsDoneOperationIcon"
android:layout_toLeftOf="@id/operationsDoneStatusIcon" />
</RelativeLayout>
但结果不是我想要实现的......这里是截图:
我缺少什么想法?
谢谢!