Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

android - Popup over incoming-call screen

I want to create a customized popup over the android's incoming call screen where I wish to add information for the user. I want the popup to not disable any clickability from the background so that the user could still answer the call.

I know it is possible since many applications do it, e.g. MeZeZe app: enter image description here

Some more information:

  1. A translucent theme did not work since it cancels the former activity's clickability.
  2. A toast is not an option - I don't want it to disappear.
  3. I know there are many similar threads - I read many of them and none answer my specific problem.
  4. I already know how to "make something happen" once a call is receiver, so no need for INCOMING_CALL activity tips.

Would appreciate any help! Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to keep the Call activity still clickable, but not have any controls on your overlay, you can do this by calling

getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);

In the onCreate() method of the activity that is shown over the call.

The layout parameters useable together with this are:

android:windowBackground="@android:color/transparent" 
android:windowIsTranslucent="true" 
android:windowAnimationStyle="@android:style/Animation.Translucent"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...