我将cardview用作编写的自定义视图的根。我使用的是v7支持库。我的XML如下所示:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="6dp"
card_view:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- some other views -->
</LinearLayout>
</android.support.v7.widget.CardView>
我的问题是我的名片视图周围出现白色边框。看起来好像在那里指示标高,因为它在右侧较厚。我已经尝试过调整,cardElevation
并且MaxCardElevation
在XML中像这样:card_view:cardElevation="0dp"
并在我的自定义视图的代码中扩展了CardView并使用以下布局:
setCardElevation(0);
setMaxCardElevation(0);
但是白色边框仍然存在。我不确定如何摆脱它。如果有人对发生这种情况的原因有任何意见,或者对我如何删除白色边框提出了建议,将不胜感激。非常感谢。
我知道已经晚了,但是对于任何有类似问题的人:
我遇到了同样的问题:棒棒糖装前的设备上显示白色边框。
我解决了它的设置cardPreventCornerOverlap到false
你的XML。
像这样:
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="6dp"
card_view:cardPreventCornerOverlap="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- some other views -->
</LinearLayout>
</android.support.v7.widget.CardView>
希望这可以帮助!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句