2017-04-19 89 views
0

我用這個代碼添加海拔佈局安卓:刪除海拔保證金的底部

<android.support.v7.widget.CardView 
     android:id="@+id/card_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:cardCornerRadius="0dp" 
     app:cardElevation="6dp" 
     app:cardPreventCornerOverlap="false" 
     app:cardUseCompatPadding="true" 
     app:contentPadding="0dp" 
     android:outlineProvider="bounds" 
     android:layout_marginLeft="-7dp" 
     android:layout_marginRight="-7dp" 
     android:layout_marginTop="-7dp" 
     android:paddingTop="7dp"> 

但擡高的底部添加邊距,我不能除去保證金底部

圖片:enter image description here

+0

嘗試:'card_view:contentPadding =「 - 8dp」'...... – rafsanahmad007

+0

@ rafsanahmad007不能正常工作 –

+0

請問您可以發佈您當前視圖和預期輸出的圖像嗎? – FAT

回答

0

CardView在5.0之前的平臺中添加了填充以繪製陰影。在Lolipop中,如果你不想要任何差距,你不應該設置useCompatPadding=true

+0

在我的代碼有應用程序:cardUseCompatPadding =「true」,但不工作 –

+0

你應該刪除它 – John

+0

不工作。在pre lililop marginBottm =「 - 7dp」不工作,但> lililop工作 –