Programmatically set android:windowIsTranslucent -
I was able to create floating activity after following this tutorial
However, For, I had to add this line to Is it possible to use only Android / Java code to have the same effect? (For example, Thank you in advance for your help. [edit 01] Then, in But it has no effect ... I'm scared, no. You must do this in when we < Code> super.onCreate (savedInstanceState); Activity class provides a blank graphical window on which we set our content ie.views. And a theme is applied on this subject and then the content is loaded on this view. The sequence will be, For example. styles.xml Then set your theme to styles.xml :
& item name = "android: windowIsTranslucent" & gt; True & lt; / Item & gt;
activity. Unprotected audio () or such ...)
styles.xml should not be changed (and I do not know what is in it ...). But for testing purposes, I am using the default:
& lt; Resources & gt; & Lt; Style name = "appbashtheme" parent = theme "AppCompat.Light" & gt; & Lt; / Style & gt; & Lt; Style name = "Aaptim" parent = "appbashtheme" & gt; & Lt; / Style & gt; & Lt; / Resources & gt; [edit 02] I like what I want (according to the API description: "value new features in the theme" ) So I created the following
custom_style.xml :
On Attachtovondo () , I called:
getTheme (). ApplyStyle (R.style.MyCustomStyle, true);
< P> Can this be the only effect using the Android / Java code?
styles.xml the value of FIAIM's
android: windowIsTranslucent can not be changed programmatically
& lt; Style name = "Aaptim" parent = "appbashtheme" & gt; & Lt ;! - All customizations that are not specific to a particular API-level can go here. - & gt; & Lt; Item Name = "Android: Window Background" & gt; @drawable / background & lt; / Item & gt; & Lt; Item name = "android: windowNoTitle" & gt; True & lt; / Item & gt; & Lt; / Style & gt; & Lt ;! - The application theme. Without title bar - & gt; & Lt; Style name = "Aaptim. None" parent = "appbashtheme" & gt; & Lt ;! - All customizations that are not specific to a particular API-level can go here. - & gt; & Lt; Item Name = "Android: Window Background" & gt; @drawable / background & lt; / Item & gt; & Lt; Item name = "android: windowNoTitle" & gt; True & lt; / Item & gt; & Lt; / Style & gt; & Lt ;! - floating activity subject - & gt; & Lt; Style name = "Theme_Translucent" parent = "Android: Style / Theme. No Title Bore." Fullscreen "& gt; & Lt; Item Name = "Android: Window Background" & gt; @Android: Color / Transparent & lt; / Item & gt; & Lt; Item name = "android: windowFrame" & gt; @ Null & lt; / Item & gt; & Lt; Item name = "android: windowContentOverlay" & gt; @ Null & lt; / Item & gt; & Lt; Item name = "android: windowIs floating" & gt; True & lt; / Item & gt; & Lt; Item name = "android: backgroundDimEnabled" & gt; True & lt; / Item & gt; & Lt; Item name = "android: windowIsTranslucent" & gt; True & lt; / Item & gt; & Lt; Item name = "android: windowNoTitle" & gt; True & lt; / Item & gt; & Lt; Item name = "android: windowAnimationStyle" & gt; @Android: style / animation Dialog & lt; / Item & gt; & Lt; Item name = "Android: Window fullscreen" & gt; True & lt; / Item & gt; & Lt; / Style & gt;
floating activity as follows:
Crate on public void (bundled saved instenstate) {Super.onCreate (savedInstanceState); SetTheme (R.style.Theme_Translucent); // Set SetCentureview (...)}
Comments
Post a Comment