0
我正在爲圖像製作面具。在我的大多數設備上,它工作正常。以下是我如何製作它。透明面具顯示爲黑色
<ImageView
android:id="@+id/im_photo"
android:layout_width="85dip"
android:layout_height="64dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="8dip"
android:scaleType="centerCrop" />
<View
android:layout_width="85dip"
android:layout_height="64dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="8dip"
android:background="@drawable/rounded_mask_background"
android:duplicateParentState="true" />
面具
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime">
<item android:state_selected="true" android:state_activated="true" android:drawable="@drawable/selected_patch" />
<item android:state_activated="true" android:drawable="@drawable/rounded_mask_selected" />
<item android:state_selected="true" android:drawable="@drawable/rounded_mask_selected" />
<item android:state_checked="true" android:drawable="@drawable/rounded_mask_selected" />
<item android:state_focused="true" android:drawable="@drawable/rounded_mask_selected" />
<item android:state_pressed="true" android:drawable="@drawable/rounded_mask_selected" />
<item android:drawable="@drawable/rounded_mask_unselected" />
</selector>
rounded_mask_unselected
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="-10dp"
android:left="-10dp"
android:right="-10dp"
android:top="-10dp">
<shape android:shape="rectangle">
<stroke
android:width="10dp"
android:color="@color/dark_gray" />
<corners android:radius="20dp" />
</shape>
</item>
</layer-list>
不幸的是在某些設備(如Galaxy Tab的7.7),我的面具是completle黑色(如果我刪除它,我看到揭露圖像)
我該如何解決它?
我看到了這樣的相關硬件加速效果。我建議嘗試在視圖上啓用/禁用硬件加速。 – HexAndBugs
@HexBugsAndSausageRolls改變硬件加速沒有效果 – Yarh