1, first to create an activity, in the activity of the OnCreate function we set it to full screen, then set the activity of the width of the full screen *0.9, and then set the background image is translucent. 9 images. This is already a non-full-screen form.
This.requestwindowfeature (Window.feature_no_title); This.getwindow (). SetFlags (WindowManager.LayoutParams.FLAG_ Fullscreen,windowmanager.layoutparams.flag_fullscreen); Setcontentview (R.layout.activity_webview); WindowManager Windowmanager=getwindowmanager ();D isplay display=windowmanager.getdefaultdisplay (); Layoutparams Params=getwindow (). GetAttributes ();p arams.height= (int) (Display.getheight () *0.9);p arams.width= (int) (Display.getwidth () *0.9);p Arams.alpha=1.0f;getwindow (). SetAttributes (params), GetWindow (). Setgravity ( Gravity.center); GetWindow (). Setbackgrounddrawableresource (R.DRAWABLE.WEBVIEWBG);
2. Add a theme to Values/styles.xml to use the activity created above. The effect of this theme is to make the original black box become translucent
<!--webview Theme-- <style name= "Webviewtheme" parent= "@android: style/ Theme.Translucent.NoTitleBar.Fullscreen "> <item name=" Android:windowframe "> @null </item><! --Border--><item name= "android:windowisfloating" >true</item><!--is floating on the activity now--><item name = "Android:windowistranslucent" >false</item><!--translucent--><item name= "Android:windownotitle" > true</item><!--Untitled--><item name= "Android:background" > @android:color/transparent</item> <item name= "Android:windowbackground" > @android:color/transparent</item><!--background Transparent--><item Name= "android:backgrounddimenabled" >false</item><!--Blur-- </style>
3, in manifest inside set activity of theme
<activity android:name= "com.crystal.geart3d.WebviewActivity" android:screenorientation= "Landscape" android:theme= "@style/webviewtheme" > </activity>
Below are
Android Activity Hover Translucent border