Android recycleview和cardview结合使用出现的边角阴影问题
解决前的那个“添加数据项”的黑边框是由于引入xml文件的时候使用错了方法。
改正如下:
(错误)private View mHeader = Global.inflate(R.layout.body_data_header);
(正确)private View mHeader = LayoutInflater.from(this).inflate(R.layout.body_data_header,null);
这样就不会出现黑色的边框了。
最终CardView属性设置如下:
<android.support.v7.widget.CardView
android:id="@+id/content_cv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:layout_marginTop="12dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="10dp"
app:cardElevation="10dp"
>
解决前:
解决后: