2015-02-08 33 views
1

我正在嘗試使用半透明背景實現簡單的cardview。奇怪的CardView行爲

<android.support.v7.widget.CardView 
     android:id="@+id/card_view" 
     app:cardBackgroundColor="#33FFFFFF" 
     app:cardCornerRadius="4dp" 
     android:foreground="#33FFFFFF" 
     android:padding="20dp" 
     android:layout_width="match_parent" 
     android:layout_height="100dp"> 
...... 
</android.support.v7.widget.CardView> 

而這正是導致L和PREL

的Android L:(Nexus 5的) enter image description here

預L:

enter image description here

任何想法如何解決前L看起來像L? 正如你所看到的,卡周圍有太多的邊框/筆劃。 我可以猜到它涉及陰影和東西...

謝謝。

回答

0

看起來它在google forums

由於已知缺陷@benhylau爲cardview提供實現與阿爾法here

有沒有可能以色cardview背景#__FFFFF因爲它忽略了透明度值。需要使用alpha屬性

+1

是的,將其設置在Java中。像這裏:https://github.com/BerlinMeshnet/cjdns-android/pull/21 https://github.com/BerlinMeshnet/cjdns-android/pull/21/files#diff-242658fb5c71623f8e6c0c02f8650df2R242 – benhylau 2015-02-08 22:51:31