Reputation: 22173
I'm trying to create a view as tutorial for my activity. I need to show only some text with a translucent background an leave a "hole" transparent to see the background button of the original activity. I can use a framelayout with two different sub-layout (the original one and the tutorial one) and I can set visible/invisible the tutorial layout. The problem is: I don't know how I can create a "hole" in the tutorial sub-layout. How can I do?
Upvotes: 0
Views: 3709
Reputation: 1745
For create a "hole" or circular view you need create a drawable
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@android:color/transparent" />
</shape>
And create a imageview in the position and size that you want and set this drawable like background.
Also you can use #00000000 intead @android:color/transparent
Or use TutorialView library on github
Upvotes: 1
Reputation: 2225
background colors should transparent, opaque I hope, it will work for you.
circle_background.xml file
<shape
android:shape="ring"
android:useLevel="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/blue_pressed" />
</shape>
view_background.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/circle_background"
>
//add more views if u wanto
</LinearLayout>
Upvotes: 1