"Android" sets the height of the bottom bar based on the screen resolution

Source: Internet
Author: User

<pre name= "code" class= "java" >public void Setfooterheightwithscreen () {//Get screen resolution int Srcwidth  = Getwindowmanager (). Getdefaultdisplay (). getwidth ();//LOG.I ("F", srcwidth.tostring ());//system.out.print (srcWidth );//Get button B1 = (button) Findviewbyid (r.id.footer1); Button B2 = (button) Findviewbyid (R.ID.FOOTER2); Button B3 = (button) Findviewbyid (R.ID.FOOTER3); button b4 = (button) Findviewbyid (r.id.footer4);//Gets the button picture of the High drawable r=this.getresources (). Getdrawable ( R.DRAWABLE.MAIN_HUNT0); Bitmapdrawable b= (bitmapdrawable) R; Bitmap T=b.getbitmap (); T.getheight ()//button to get parent control set high Linearlayout.layoutparams l= (layoutparams) based on screen resolution B1.getlayoutparams (); int i= (int) ((srcwidth/4.0* t.getheight ())/(T.getwidth ())); L.height=i;b1.setlayoutparams (L); B2.setlayoutparams (L) ; B3.setlayoutparams (L); B4.setlayoutparams (L);//int i= (int) ((srcwidth/4.0* b1.getheight ())/(B1.getwidth ()));// B1.setheight (i);}



No reprint is permitted without permission.

"Android" sets the height of the bottom bar based on the screen resolution

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.