Android Activity Hover Translucent border

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.