我有我的RecyclerView
項目佈局的左邊,看起來像這樣如果我設置回收站查看子項目高度的簡單視圖match_parent它變得不可見
<View
android:id="@+id/status_view"
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@color/pending_color_my_schedule" />
我需要它的全高度的簡單視圖他的父(RelativeLayout的)這樣
父佈局的代碼
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/my_schedule_item_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/my_schedule_item_margins"
android:layout_marginRight="@dimen/my_schedule_item_margins"
android:background="@drawable/shadow_212838"/>
But when I set my `View` to `match_parent's` height it becomes invisible and I can't find a clue why.
If I set it to 150dp or 200dp it works, but I need it to be flexible as the height of parent.
Entire XML file (UPD)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/my_schedule_item_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/my_schedule_item_margins"
android:layout_marginRight="@dimen/my_schedule_item_margins"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/shadow_212838">
<TextView
android:id="@+id/time_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/my_schedule_text_margins"
android:layout_marginBottom="@dimen/my_schedule_text_margins_small"
android:layout_marginStart="@dimen/my_schedule_text_margins_start"
android:layout_marginEnd="@dimen/my_schedule_text_margins"
android:textColor="@color/black_standart"
android:textSize="20sp"
tools:text="Tomorrow: 11:45 - 15:00" />
<TextView
android:id="@+id/status_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/my_schedule_text_margins"
android:layout_marginBottom="@dimen/my_schedule_text_margins_small"
android:layout_marginEnd="@dimen/my_schedule_text_margins"
android:layout_alignParentEnd="true"
android:textSize="12sp"
tools:text="Pending" />
<ImageView
android:id="@+id/status_color_image"
android:layout_width="@dimen/my_schedule_item_status_size"
android:layout_height="@dimen/my_schedule_item_status_size"
android:layout_marginTop="@dimen/my_schedule_status_icon_top_padding"
android:layout_marginEnd="@dimen/my_schedule_text_margins_small"
android:layout_toStartOf="@id/status_text"
android:background="@drawable/pending_circle" />
<TextView
android:id="@+id/location_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/my_schedule_text_margins_small"
android:layout_marginBottom="@dimen/my_schedule_text_margins_small"
android:layout_marginEnd="@dimen/my_schedule_text_margins_small"
android:layout_alignStart="@id/time_text"
android:layout_below="@id/time_text"
android:drawablePadding="@dimen/my_schedule_text_margins_small"
android:drawableStart="@drawable/ic_location_grey"
android:textSize="12sp"
tools:text="Factory and Co Aeroville" />
<TextView
android:id="@+id/function_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/my_schedule_text_margins_small"
android:layout_marginEnd="@dimen/my_schedule_text_margins_small"
android:layout_alignStart="@id/time_text"
android:layout_below="@id/location_text"
android:paddingBottom="@dimen/my_schedule_text_margins_start"
android:textSize="14sp"
tools:text="Function: Manager" />
<Button
android:id="@+id/decline_button"
android:layout_width="@dimen/my_schedule_item_button_width"
android:layout_height="@dimen/my_schedule_item_button_height"
android:layout_marginBottom="@dimen/my_schedule_item_buttons_bottom_padding"
android:layout_alignStart="@id/function_text"
android:layout_below="@id/function_text"
android:background="@drawable/blue_transparent_btn_bg"
android:text="@string/decline"
android:textColor="@color/clear_blue" />
<Button
android:id="@+id/confirm_button"
android:layout_width="@dimen/my_schedule_item_button_width"
android:layout_height="@dimen/my_schedule_item_button_height"
android:layout_marginStart="@dimen/my_schedule_item_buttons_bottom_padding"
android:layout_below="@id/function_text"
android:layout_toEndOf="@id/decline_button"
android:background="@drawable/blue_solid_button_bg"
android:text="@string/confirm"
android:textColor="@color/white_standart" />
<View
android:id="@+id/status_view"
android:layout_width="5dp"
android:layout_height="wrap_content"
android:background="@color/pending_color_my_schedule" />
</RelativeLayout>
這是整個佈局,它被設置爲match_parent。現在這個視圖非常大,佔據了整個屏幕。
我不能沒有添加信息提交,所以我將添加Lorem存有,對不起
Lorem存有簡直是印刷排版行業的虛擬文本。 Lorem Ipsum自從16世紀以來一直是業界標準的虛擬文本,當時一臺未知的打印機採用了一種類型的廚房,並將其製作成樣本書。它不僅存活了五個世紀,而且還實現了電子排版的飛躍,基本保持不變。它在20世紀60年代隨着包含Lorem Ipsum段落的Letraset工作表的發佈以及最近使用包括版本的Lorem Ipsum在內的Aldus PageMaker等桌面出版軟件而得到了推廣。
您是否嘗試將父高度修改爲'match_pare nt'? –
我覺得你要存檔的東西不同於你正在編碼的東西,recylerview項目佈局有一個類似於 –
@EasyJoin的視圖。淨,它的工作,視圖是可見的,但現在它是非常大的(整個屏幕),所以我的父母應該是wrap_content –