我正在使用LinearLayout水平从适配器加载视图。虽然我正在使用wrap_content,并且布局中的视图都对齐到顶部。 linearLayout下面有一个空白区域。这是一个错误,或者我做错了什么。请检查连接带底部空白的LinearLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:clickable="true"
android:background="@drawable/recycler_selector">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="50dp"
android:id="@+id/group_chat_photo" />
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="5"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_height="wrap_content"
style="@style/ListTitleTextStyle"
android:id="@+id/group_name" />
<TextView
android:layout_width="wrap_content"
android:padding="5dp"
android:layout_toStartOf="@id/group_name"
android:layout_height="wrap_content"
android:id="@+id/num_of_group_users"
style="@style/PresenceTextStyle"
android:layout_toEndOf="@id/group_name"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/SubTitleTextStyle"
android:layout_below="@id/group_name"
android:id="@+id/group_members_presence"/>
</RelativeLayout>
<ImageView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:src="@drawable/ic_dots_vertical_grey600_24dp"
android:contentDescription="@string/group_chat_options"
android:id="@+id/group_chat_options"/>
</LinearLayout>
也许有一些错误的适配器?不要认为你的问题在LinearLayout中。它是一个RecyclerView适配器吗? –
你可以请你发布你的适配器类吗? – FAT
@Contextioner在下面看到我的答案。我重新设计了你的xml。输出见附图。谢谢 – FAT