问题描述
-
这是我的观点
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/imgBGImage" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:adjustViewBounds="true" android:scaleType="fitXY" /> <com.example.custom.CustomView android:id="@+id/customView" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true"/> </RelativeLayout>
-
在ImageView中,我正在添加背景图像。
-
在CustomView中(扩展了FrameLayout)我正在使用dispatchDraw方法中的画布绘制自己的视图。
-
现在,搬运工duff模式在我的CustomView中可以完美工作,这意味着我在CustomView中有多个视图,并且在这些搬运工之间的duff模式之间的工作原理如下图所示
-
使用此代码
canvas.drawBitmap(viewBitmap,paint); // (in paint I have set overlay porterduffmode)
-
但是,当我投放背景图片时,背景图片存在问题,然后我的CustomView的视图必须根据我的背景图片绘制。这意味着我想根据我的背景图片在CustomView中使用搬运工duff模式进行绘制因此是整个customView。(我已经将背景图片设置为imgBGImage ImageView)
- 现在我得到这样的结果:-
- 预期结果:-
任何帮助将不胜感激。谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)