I have an activity defined like this
<activity android:name=".queue.ItemDetailActivity"
android:theme="@android:style/Theme.Dialog"></activity>
This activity implements runnable and shows a progress bar while data is retrieved from the server. I would like to have the dialog invisible until the data is loaded. Is there a way for the activity to start invisible and then later use setVisible(true);
to make it appear?
In Android, we can create a transparent activity that will not be visible but your application will be running. The best part of this transparent activity is that you can create a transparent activity by just changing the resource file and we need not write the java or kotlin code for the same.
3 by just adding android:theme="@android:style/Theme. Translucent" in the activity tag in the manifest. This works fine for 2.2 also.
Explanation. Generally, every activity is having its UI(Layout). But if a developer wants to create an activity without UI, he can do it.
Try this style for the activity.
<style name="Invisible" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With