2017-07-07 1 views
2

Carte Android montre bordure inutile autour de la carte. J'ai essayé différentes choses mais je ne suis pas capable de l'enlever. Cela se produit lorsque je donne une couleur de fond personnalisée à la carte. Lorsque je supprime cardBackgroundColor et lorsque la valeur par défaut est utilisée. Alors la bordure inutile n'est pas visible.cardview android montrant la bordure autour de la carte

Je dois utiliser un code de couleur d'ombre et de tranparent.

Voici ma mise en page Vignettes

  <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> 

Et la vue créée est ce

enter image description here

Voir la frontière supplémentaire à gauche, à droite et en haut de Vignettes et à l'intérieur de l'ombre de la carte.

+0

https://stackoverflow.com/questions/29392763/cardview-white-border-around-card#comment64255333_30242617 –

+0

@IntelliJAmiya, c'est une bibliothèque, donc augmentera la taille de l'application. Le cardview n'a-t-il pas de fonctionnalité pour l'enlever? –

+0

supprimer application CardView: contentPadding et ajouter l'android: rembourrage dans LinearLayout de l'intérieur de la CardView ...! –

Répondre

0

essayez ceci.

<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" > 
+0

De cette façon, je ne suis pas en mesure de voir l'ombre, je dois montrer l'ombre aussi .. –

+0

je vérifie à nouveau et j'ai obtenu ce résultat ce que vous voulez – farhana

0

Enlevez ces lignes de Vignettes

app:contentPadding="@dimen/margin_large" 
     app:cardUseCompatPadding="true" 

+0

J'ai essayé mais malheureusement pas de chance. –

0

je vérifie à nouveau et je me suis ce résultat ce que vous voulez. <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorPrimay >