我的Android XML布局如下所示
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center"
android:background="?android:colorBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<SomeView
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@android:color/transparent"/>
</LinearLayout>我需要的是在我的小视图大小的背景LinearLayout中有一个‘透明’的洞。如下图所示:

这个是可能的吗?多么?
发布于 2016-08-04 18:39:04
在要使其透明的视图中使用透明背景,以便在其后面有任何视图时将其显示
例如:
android:background="#00000000""#00000000"
发布于 2016-08-04 22:01:02
如果您希望该视图具有透明背景,则可以执行以下操作:-
希望这能有所帮助。
示例:
<LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:background="@android:color/holo_red_dark">
<LinearLayout
android:orientation="vertical"
android:gravity="center"
android:background="@android:color/holo_blue_bright"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="30dp">
<View
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@android:color/holo_red_dark"/>
</LinearLayout>
</LinearLayout>发布于 2016-08-04 22:05:38
查找Alpha通道-我认为这基本上就是您在这里寻找的。
https://stackoverflow.com/questions/38764883
复制相似问题