2017-07-07 15 views
2

カードの周囲に不要な枠線が表示されています。私は別のものを試しましたが、私はそれを取り除くことができません。 カードにカスタム背景色を付けると起こります。 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> 

され、作成されたビューは、この

enter image description here

がcardviewの左、右、上に、カードの影の内側に余分な境界線を参照してくださいです。

+0

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

+0

@IntelliJAmiya、それはライブラリですので、アプリのサイズが大きくなります。カードビューにこれを削除する機能はありませんか? –

+0

CardView app:contentPaddingを削除して、CardView内のLinearLayoutにアンドロイド:パディングを追加して...! –

答えて

0

これを試してください。

<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

このように私は影を見ることができません、私は影を表示する必要があります.. –

+0

私はそれをもう一度チェックし、私はあなたが望む結果を得ました – farhana

0

私は再びそれをチェックして、私は何をしたいという結果を得ましたCardview

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

私は試してみましたが、残念なことに運がありません。 –

0

からこれらの行を削除します。 <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorPrimay >

関連する問題