Я использую RecyclerView с реализацией GridLayoutManager spanCount 3, и проблема заключается в том, что фоновая граница отображается несколько раз, см. снимок экрана и макет. Но мне нужно сделать единую рамку с элементом строки на этом адаптере. Так что делитесь своим опытом и заранее спасибо!
И это строка RecyclerView.Adapter xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linSubCat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="@drawable/shape_sub_category"
android:gravity="center"
android:orientation="vertical"
android:padding="5dp">
<ImageView
android:id="@+id/subcategory_image_listview"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_gravity="center" />
<TextView
android:id="@+id/subcategory_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="3dp"
android:gravity="center|center_vertical"
android:padding="3dp"
android:textColor="@color/category_color" /></LinearLayout>
И файл shape_sub_category.xml границы фона.
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="0.5dp"
android:color="@color/category_color" />
<solid android:color="@android:color/transparent" /></shape>