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?
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>
Related
I removed the black background of the dialog popup, but now it doesn't close after clicking around the dialog. Backbutton works fine, I'm guessing that an item is missing from the custom theme.
Here is the custom theme I am using.
<style name="customDialogTheme">
<item name="android:windowFrame">#null</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowTitleStyle">#null</item>
<item name="android:windowAnimationStyle">#android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:background">#android:color/white</item>
</style>
NOTE: Even if i re-enable the black background by setting the <item name="android:backgroundDimEnabled">false</item> to true, it still doesn't click away. I'm pretty sure that I am missing a parameter.
Edit: Only change I made in the java code is:
setStyle(DialogFragment.STYLE_NORMAL, R.style.customDialogTheme);
Seems like I just needed to add parent="Theme.AppCompat.Dialog" to the style.
EDIT: The missing parameter was <item name="android:windowCloseOnTouchOutside">true</item>
Actually i am creating transparent overlay Application but when the the activity starts the application name is showing in the middle of screen rest everything is working fine...
So how can i remove the application name
Check Screnshot : the Screenhot text is the Application Name
Manifest file Code :
<activity
android:name=".activity.ServiceManagement"
android:theme="#style/Theme.Transparent"></activity>
Style sheet :
<style name="Theme.Transparent" parent="AppTheme">
<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>
If your transparent activity is an AppCompatActivity, then use Theme.AppCompat.NoActionBar as its parent theme. Directly adding these attributes to your activity's theme will also work.
<!-- no 'android:' prefix -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
I have an Activity inherited from AppCompactActivity. in manifest for activity set theme:
<activity
android:name=".activity.CameraSettingsActivity2"
android:theme="#style/Theme.AppCompat.Light.Dialog" />
but the activity still displays in a fullscreen instead of dialog window.
I have been trying different themes such as ..
Theme.AppCompat.Dialog
Theme.AppCompat.Dialog.Alert
Theme.AppCompat.Dialog.MinWidth
none of them seems work.the activity still like this
try using this style <style name="CustomDialogTheme" parent="android:Theme.Dialog">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
</style>
I would like to make an application that uses the same theme as the 'complete action using' app on Android 5. Does it even exist or do I have to write that on my own?
I finally found out, how to achieve this. The theme is: Theme.Material.Light.NoActionBar, then you need to add a fragment. Edit the theme so the activity is transparent:
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
And finally set the background of the fragment to white.
android:background="#color/primary"
I want my activity to show up on lockscreen(which is working fine). but i want to get that activity transparent..
I tried 2 methods both are not allowing my activity to show on lockscreen.
Method 1
android:theme="#android:style/Theme.Translucent.NoTitleBar"
Method 2
<style name="Theme.Transparent" parent="android:Theme">
<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>
</style>
Both are not allowing to show the activity on lockscreen.
Is there any method you know?
Try setting following codes in your activity.I have not tried it, it may work.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
This is because you defined windowIsFloating to be true. An activity won't show in front of a lockscreen if the width or height are modified, or if it is set to be floating.
You should set windowIsFloating to false, windowBackground to transparent and if you would still like the dialog-effect, create a dialogfragment, and show that in your onCreate of the activity. And of course, remove the ActionBar from the activity:
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>