Search code examples
javaandroiduser-interfacehomescreen

Launching a transparent activity on HomeScreen


So there is an activity containing a webview. On launch/click on App Icon it should launch activity with webview as dialog on the HomeScreen of the device. Is there a way to achieve this?


Solution

  • Yes, you can do it. Set the theme of MainActivity to Dialog, then you'll achieve it.

      <activity android:name=".MainActivity"
          android:theme="@style/Theme.AppCompat.Dialog">
          <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
          </intent-filter>
        </activity>
    

    It works fine for me. Hope it can help you~