Я хочу, чтобы в моем приложении были книжные полки, поэтому я использовал просмотр карточек, но не могу уменьшить расстояние между карточками по бокам.все, что я пробую, меняет расстояние сверху и снизу.
это CardView xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="110dp"
android:layout_height="180dp"
xmlns:cardview="http://schemas.android.com/tools"
android:layout_marginBottom="5dp"
android:layout_marginEnd="0dp"
cardview:cardCornerRadius="10dp"
cardview:cardElevation="0dp"
app:cardUseCompatPadding="false">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/shelf_img"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="@drawable/shelf" />
<ImageView
android:id="@+id/book_img"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#2d2d2d"
android:scaleType="centerCrop"
/>
<ImageView
android:id="@+id/check_box"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/v_pink"
android:visibility="invisible"/>
<TextView
android:visibility="gone"
android:id="@+id/book_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Name"
android:textColor="@color/grey"
android:textSize="13sp" />
</RelativeLayout>
, а представление рециркулятора определяется следующим образом:
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/progress_bar"
android:layout_marginTop="16dp">
</android.support.v7.widget.RecyclerView>
и в упражнении -
mRecyclerView = findViewById(R.id.recycler_view);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 3));
в конце концов это выглядит так:
Я хочукарты должны быть близко друг к другу со стороны , поэтому они будут выглядеть как одна длинная полка ...
просьба помочь ??
также, если кто-то знает, как это сделатья положил первый ImageView ("book_img") перед вторым ("shelf_img"), это будет потрясающе ... единственный способ, которым я преуспел сейчас, это один выше второго
edit : Мне удалось это с RelativeLayout
спасибо!