<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