내 응용 프로그램 (지원 라이브러리 사용)에 카드보기가 있는데, 카드가 모두 한 행에 들어 가지 않으면 랩 어라운드를 원합니다. 현재 그들은 수직으로 쌓아 올리고 있습니다. 목록에서 유일한 요소 인 경우 랩을 수행 할뿐만 아니라 전체 상위 항목을 채울 수있는 방법이 있습니까?CardView wrapping
이상적으로 나는 한 줄에 두 장의 카드를 놓고 그 지점에서 새로운 줄로 감싸는 것이 좋습니다. recyclerview를 포함
보기 :
이<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/my_rootlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/my_window"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:orientation="vertical">
<TextView
android:id="@+id/my_headertext"
style="@style/roboto_header_text_black"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_weight=".15"
android:gravity="center"
android:padding="@dimen/device_padding"
android:text="@string/en_us_my_header"
android:textIsSelectable="false" />
<android.support.v7.widget.RecyclerView
android:id="@+id/my_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".85"
/>
</LinearLayout>
CardView :
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:orientation="vertical"
card_view:cardCornerRadius="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:src="@drawable/default_image"
android:scaleType="centerCrop"
android:adjustViewBounds="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#99000000"
android:gravity="center_vertical"
android:paddingLeft="8dp">
<TextView
android:id="@+id/my_listitem_title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="This is my title"
android:textColor="@color/white"
android:textSize="20sp"
android:fontFamily="sans-serif-light"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:paddingBottom="4dp" />
</LinearLayout>
</RelativeLayout>
<ProgressBar
android:layout_width="match_parent"
android:layout_height="8dp"
android:indeterminate="false"
style="?android:progressBarStyleHorizontal"
android:progress="45" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="2dp"
android:paddingBottom="2dp">
<TextView
android:id="@+id/code_text_block"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="14sp"
android:text="ABC" />
<TextView
android:id="@+id/my_listitem_id_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#123456"
android:textColor="@color/black"
android:layout_marginLeft="8dp" />
</LinearLayout>
<TextView
android:id="@+id/my_listitem_date_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:text="Nov 5 - Nov 12, 2016"
android:textColor="#7D7D7D" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Download"
android:textAllCaps="true"
android:fontFamily="sans-serif"
android:textStyle="bold"
android:id="@+id/download_button"
android:background="@color/white"
android:textColor="@color/black"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingTop="8dp"
android:paddingBottom="8dp" />
</LinearLayout>
</LinearLayout>