Android Hover Windows app

Source: Internet
Author: User
<span id="Label3"></p><p><p>Some of the code is as Follows:</p></p><p>public void Showalertscreen (Context context,string titles,string content,string phone)<br>{<br>Get Service<br>WM = (windowmanager) Context.getsystemservice ("window");<br>Windowmanager.layoutparams mwindowparams = new Windowmanager.layoutparams ();<br>Set the window type, a total of three kinds application windows, sub-windows, System windows<br>There are 23 constants in the API that start with Type_<br>Mwindowparams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;<br>Set the desired bitmap format<br>Mwindowparams.format = pixelformat.rgba_8888;<br>Mwindowparams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;<br>The following properties are common in the layout params, such as gravity, coordinates, width, height<br>mwindowparams.gravity = Gravity.left | gravity.top;<br><br><br>Mwindowparams.width = WindowManager.LayoutParams.WRAP_CONTENT;<br>Mwindowparams.height = WindowManager.LayoutParams.WRAP_CONTENT;<br><br><br> <br>Layoutinflater inflater= (layoutinflater) Context.getsystemservice (context.layout_inflater_service);<br>View=inflater.inflate (r.layout.activity_call_label, null);<br>TextView TV = (TextView) View.findviewbyid (r.id.txtphone);<br>Tv.settext (phone);<br>TextView title = (TextView) View.findviewbyid (r.id.txttitle);<br>TextView alert = (TextView) View.findviewbyid (r.id.txtalert);<br>ImageButton btnclose = (ImageButton) View.findviewbyid (r.id.btnjb2);<br>If (!titles.equals (""))<br>{<br>Title.settext (titles);<br>}<br><br>Alert.settext (content);<br>Btnclose.setonclicklistener (new View.onclicklistener () {<br><br>@Override<br>public void OnClick (View Arg0) {<br>TODO auto-generated Method Stub<br>Try<br>{<br>Get Service<br><br>Alertdialog.builder Builder = new Alertdialog.builder (firewallservice.this);<br><br>Builder.settitle ("please Select a report type")//title<br>. setitems (r.array.stype, New Dialoginterface.onclicklistener () {//content<br>@Override<br>public void OnClick (dialoginterface dialog, int Which) {<br><br>Wtype = (which+1) + "";<br>New Thread () {<br>@Override<br>public void Run ()<br>{<br>webclasscommonentity result = new Webutil (). markphone (getapplicationcontext (), configuration.imei,phone_num,wtype);<br><br>}<br>}.start ();<br> <br>}});<br>Alertdialog AD = Builder.create ();<br>Ad.getwindow (). SetType (WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG); The Shutdown dialog box in the system is this property<br>Ad.getwindow (). SetType (WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);<br>Ad.setcanceledontouchoutside (false); Clicking on the outside area won't let dialog disappear.<br>Ad.show ();<br><br>}<br>Catch (Exception Eee)<br>{<br> <br>}<br>}<br>});<br><br>Add a specified view<br>Wm.addview (view, mwindowparams);<br>}</p><p><p>Android Hover Windows app</p></p></span>

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.