我正在努力使一个视图的背景透明,以便在顶部视图上未绘制的任何区域都可以显示底部视图。
我已经阅读了这里的几个线程,但无论我尝试什么,顶部视图总是被绘制成黑色。
底部视图和顶部视图都继承自View基类,并且onDraw()被重写,这是我的layout.xml:
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<com.domain.myapp.MyBottomView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mybottomview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bottom_image"/>
<com.domain.myapp.MyTopView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mytopview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"/>
</merge>
有没有人能给我一些建议,我将非常感激!
谢谢 /Dee