in xml The width and height are not fixed
For example:
<android.support.v7.widget.CardView
android:id="@+id/root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp"
android:layout_gravity="center"
Set the width and height in the code
For example:
int width = DisplayUtil.getScreenWidth(holder.itemView.getContext()) - DisplayUtil.dp2px(
holder.itemView.getContext(), 105);
in xml The width and height are not fixed For example: <android.support.v7.widget.CardView android:id="@+id/root" android:layout_width="wrap_content" android:layout_height="wrap_content" app:cardElevation="0dp" android:layout_gravity="center"
Set the width and height in the code For example: int width = DisplayUtil.getScreenWidth(holder.itemView.getContext()) - DisplayUtil.dp2px( holder.itemView.getContext(), 105);
That's the breakdown RecyclerViewProxy.getMeasuredChildForAdapterPosition(RecyclerViewProxy.java:52) DiscreteScrollLayoutManager.layoutView(DiscreteScrollLayoutManager.java:225) DiscreteScrollLayoutManager.layoutViews(DiscreteScrollLayoutManager.java:214) DiscreteScrollLayoutManager.fill(DiscreteScrollLayoutManager.java:192) DiscreteScrollLayoutManager.onLayoutChildren(DiscreteScrollLayoutManager.java:120)
so how to set the width and height dynamically not fixed ?
think you