リスト項目のレイアウトを変換して、RelativeLayout を使用しようとしています (重みのあるネストされた LinearLayouts ではなく)。下の図は、リスト項目の外観を示す 2 つの画像で、各リスト項目の 4 (/5) 要素の周りに色付きの境界線が表示されています。
各リスト項目には、矢印 (紫色の境界線) を押すと展開される非表示のビューもあり、このすべての下に別の要素が表示されます (2 番目の画像の黄色の境界線)。これには、トリガーのIDと非表示のビューを設定するだけで済みます。
私が直面している最初の問題は、オレンジと紫の要素 ( O+P ) を緑と青 ( G+B )の右側にとどめ、残りのスペースをG+Bで横方向に埋めることです。
各要素の高さは 48 dp で、O+Pの幅も 48 dp です。
これまでに試みたレイアウトでは、O+Pが G+B にオーバーラップするか、 G+Bで右マージンを使用しようとすると、O+Pが画面からはみ出します。
--
<?xml version="1.0" encoding="utf-8"?>
<!-- a single row item for a Stacks listview -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/primary_elements"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/listitem_name"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="@string/lorem_title" />
<TextView
android:id="@+id/listitem_notes"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_below="@id/listitem_name"
android:text="@string/lorem_paragraph" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/secondary_elements"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/listitem_name" >
<TextView
android:id="@+id/listitem_actionable_items"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignBottom="@+id/listitem_notes"
android:layout_alignParentLeft="true"
android:layout_marginBottom="16dp"
android:background="@color/Khaki"
android:gravity="center"
android:textIsSelectable="false" />
<!-- Quick action button - specific ID is required (SlideExpandableListView lib) -->
<RelativeLayout
android:id="@+id/expandable_toggle_button"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" >
<!-- ImageView (arrow) in here, works, taken out for brevity -->
</RelativeLayout>
</RelativeLayout>
<!-- Quick action expanded view - specific ID is required (SlideExpandableListView lib) -->
<RelativeLayout
android:id="@+id/expandable"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_below="@id/primary_elements">
<!-- TODO - options inside the hidden view-->
</RelativeLayout>
</RelativeLayout>
--