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>
Related
I want this kind of translucent activity/fragment for android any help would be appreciated
Android activity/fragment overlapping here just like this one:
use this style for your app :
<style name="AppTheme.NoBackGround">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowBackground">#color/transparent</item>
<item name="android:colorBackgroundCacheHint">#color/transparent</item>
</style>
then set the blur and transparent background on the activity
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 have an application where the theme can be changed between three different ones. I have two activities that are supposed to have a transparent background and look like a dialog above the previous activity.
I've searched alot for transparent activities here on stack and most of them have the same awnsers. A custom theme with a few properties to enable a transparent background for the activity in question.
The issue for me is that i need to set this custom transparent theme on the parent activity as well to achieve any transparency at all. If i only set a transparent theme on the activity i want to be transparent, it will be a solid background. I've tried everything i could think of but it all boils down to this and im not sure what im doing wrong.
This is my two different parent themes (slimmed down to the neccesary parts):
<style name="StyledActionbar" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="android:textViewStyle">#style/Iksu.TextView</item>
<item name="windowContentOverlay">#null</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="Transparent" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="android:textViewStyle">#style/TextView</item>
<item name="windowContentOverlay">#null</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
StyledActionBar is the parent for my three different main themes that is used for all activities that are not supposed to have a transparent background (which is all but two).
Transparent is the parent for three themes that can be used on an activity where the background needs to be transparent.
So the parent activity has a theme based on the StyledActionBar theme. The activity i need to have transparent is based on the Transparent theme.
The background is solid in this state.
If i move:
<item name="android:windowIsTranslucent">true</item>
to StyledActionBar, almost everything works as a charm except a nasty bug in Android 4.4.2 causing the main activity to "fall behind" the OS view when using NavUtils for up-navigation to the main activity.
Any ideas?
in your manigest file
<activity
android:theme="#android:style/Theme.Translucent.NoTitleBar">
</activity>
and in your xml set
android:background="#android/transperent"
also you can use
android:alpha="0.50"
try this one more time :
<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>
and in the manifest file
<activity android:name=".AlertActivity"
android:theme="#style/Theme.Transparent"/>
Hope it will work for u.
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>