Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Activity Invisible by Default

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?

like image 231
Josh Avatar asked Mar 03 '11 17:03

Josh


People also ask

What is transparent activity?

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.

How do you make a transparent background on activity?

3 by just adding android:theme="@android:style/Theme. Translucent" in the activity tag in the manifest. This works fine for 2.2 also.

Is it possible to create an activity in Android without a user interface?

Explanation. Generally, every activity is having its UI(Layout). But if a developer wants to create an activity without UI, he can do it.


Video Answer


1 Answers

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>
like image 108
Jon Avatar answered Nov 04 '22 05:11

Jon