Search code examples
javaandroidpocket

How to make an overlay when sharing into app in android?


I am working on an android app that receives content from another apps sharing it via an android intent. I did the intent filter to receive the shared content into the app, but I saw that apps like Pocket made that without leaving the original app with an overlay over the app and I don't know how to do that. Does anyone know how to do that or give me some hints?

enter image description here


Solution

  • Start activity that has transparent theme with following attributes (test this on API 18 for bug):

    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:backgroundDimEnabled">false</item>
    

    Set child elements as you desire, as you would do in normal activity.