I want my activity to look like a dialog.
Well, I achieved that using android:theme="#android:style/Theme.Dialog"
Now, I also want it to be translucent as it appears in android:theme="#android:style/Theme.Translucent"
Is there a a way to mix them both using a custom style??
Please any suggestions, thanks
EDIT: achieved something similar with this:
Now i want to add border like a dialogwindow...how can i do that???
<style name="TransparentDialog" parent="#android:style/Theme.Dialog">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowFrame">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:alertDialogStyle">#android:style/Theme.Dialog</item>
<item name="android:windowAnimationStyle">#android:style/Animation.Dialog</item>
</style>
EDIT: Solved this. Check the answer
Finally achieved what i wanted with this:
Used this theme for my activity android:theme="#android:style/Theme.Translucent"
and gave this android:background="#android:drawable/dialog_frame"as background to the root element of my layout
That was so easy!
You'll need to combine the two themes together. One thing that might work is:
<style name="TranslucentDialog" parent="#android:style/Theme.Dialog">
<item name="android:background">"#33000000"</item>
</style>
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 am creating an activity and adding views to it dynamically. This activity contains an imageview and a close button. I want the background of the image which is in fact the relative layout background to be transparent so that the icons on the home screen of the device could be visible.
I have tried
Window window = this.getWindow();
window.setBackgroundDrawable(newColorDrawable(android.graphics.Color.TRANSPARENT));
and also
relativeLayout.setBackgroundColor(Color.parseColor("#00000000"));
and this as well
relativeLayout.setBackgroundColor(0x00000000);
Nothing seems to work. Any pointers will be appreciated. Thanks.
you can create theme and use it for activity
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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>
</resources>
<activity android:name=".SampleActivity" android:theme="#style/Theme.Transparent"/>
Define style theme for particular Activity.
In style.xml file
<style name="DialogTheme" parent="android:Theme.Holo.Light.Dialog">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">#null</item>
</style>
And associate this style in Manifest with activity
<activity
android:name="com.pac.activity.YOURACTIVITY"
android:screenOrientation="portrait"
android:theme="#style/DialogTheme" >
</activity>
Hi use this link http://angrytools.com/android/button/. its help for you
Set the
android:background="#android:color/transparent"
Also the colour hexa you are using is wrong...
00000000 is hexa for non transparent white
Use
Ff000000 instead
In the top most viewgroup you have. This will essentially create a background with transparent colour on which other views will lie.
You can adjust transparency using other colours in that place.
Here is a link to a doubt i have regarding my app.Any kind of help to solve this will be appreciated.
https://gamedev.stackexchange.com/q/103610/68334
Alright, after checking through the files, I believe the following configurations will work for your case.
In styles.xml, declares GdxTheme.
<style name="GdxTheme" parent="android:Theme">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:windowAnimationStyle">#android:style/Animation</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowFullscreen">false</item>
</style>
In AndroidManifest.xml, set application theme to android:theme="#style/GdxTheme".
This is all you will need to make the status bar visible.
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.
Please give me solution to hide the status bar of translucant screen, i have tries by setting Theme.NoTitleBar.Fullscreen but it works for normal activity, but its not working for the screen witch is translucant.Please give me the hint to solve the problem.
Thanks
That's how I usually do this by overriding one of standard themes.
<style name="ExampleTheme" parent="android:Theme.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
You then can apply the theme to your activity. I hope that helps.
Above solution is not work for me.
I used "#android:style/Theme.Holo.NoActionBar.Fullscreen" as parent theme.
<style name="ExampleTheme" parent="#android:style/Theme.Holo.NoActionBar.Fullscreen">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
https://developer.android.com/training/system-ui/status