Reputation: 162
My Android XML-Layout looks like this
<?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>
What I need is a 'See-Through' hole in my Background LinearLayout at the size of my small View. Like in the following Picture:
Is this possible? How?
Upvotes: 2
Views: 1310
Reputation: 452
If you wish a see-through background for the view, what can be done is :-
Hope that this helps.
Example :
<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>
Upvotes: 0
Reputation: 12181
Look up the Alpha channel - I think that's basically what you're looking for here.
Upvotes: 0
Reputation: 13153
use transparent background in views that you want to make transparent so if there is any view behind it it will display
eg:
android:background="#00000000"
Upvotes: 1