Android Cardview 在卡片周围显示不必要的边框。我尝试过不同的方法,但无法将其删除。
当我为卡片提供自定义背景颜色时会发生这种情况。
当我删除 cardBackgroundColor 并使用默认值时。那么不必要的边框就不可见了。
我必须使用阴影和透明颜色代码。
这是我的布局 CardView
<RelativeLayout
android:id="@+id/rlUserNamePassword"
android:layout_width="match_parent"
android:background="@android:color/transparent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin"
android:background="@android:color/transparent"
app:cardBackgroundColor="@color/form_card_bg_color"
app:cardElevation="@dimen/margin"
app:contentPadding="@dimen/margin_large"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/user" />
<android.support.design.widget.TextInputLayout
android:id="@+id/tilName"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yaashvi.placeandpeople.customviews.CustomEditText
android:id="@+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username"
android:singleLine="true"
android:maxLines="1"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_large"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/password" />
<android.support.design.widget.TextInputLayout
android:id="@+id/tilPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yaashvi.placeandpeople.customviews.CustomEditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:singleLine="true"
android:maxLines="1"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView >
<LinearLayout
android:id="@+id/llGo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:orientation="vertical"
android:elevation="@dimen/margin_large"
>
<include layout="@layout/go_button" />
</LinearLayout>
</RelativeLayout>
创建的视图是这样的
查看卡片视图左侧、右侧和顶部以及卡片阴影内部的额外边框。
尝试这个。
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin"
android:background="@android:color/transparent"
android:elevation="0dp"
app:cardBackgroundColor="@color/form_card_bg_color"
app:cardElevation="0dp"
app:contentPadding="@dimen/margin_large"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true" >
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)