Я делаю RecyclelerView с cardview, который работает нормально. Но это работает для устройств Android, и это RecyclerView не реагирует на размер планшета.Как я могу сделать отзывчивый макет переработчика, который будет отображать те же продукты, что и на мобильных устройствах и планшетах?как я могу это сделать?вот мой код recyclerView xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvTopBrands"
android:text="@string/top_brand"
android:textAlignment="center"
android:layout_marginTop="5dp"
android:textColor="@color/colorPrimary"
android:textSize="20sp"
android:textStyle="bold|italic"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rvTopBrandProducts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginStart="4dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvTopBrands"
app:layout_constraintVertical_bias="0.0" />
</LinearLayout>
и вот мой код recyclerView:
final JsonArrayRequest request = new JsonArrayRequest(Request.Method.GET,
URLs.viewAllLatestProduct,null,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
setLatestProductAdapter(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
и вот мой макет cardView:
<android.support.v7.widget.CardView android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="2dp"
android:background="@android:color/holo_orange_dark">
<ImageView
android:id="@+id/ivTopBrand"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:padding="2dp"
android:background="@color/white"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_feature_brand" />
</LinearLayout>
как яможно сделать адаптивный макет