04 2012 档案
摘要:EditText画行,每行画分割线。其中一些值的设置与当前手机的分辨率,屏幕密度,字体大小都有关系,下面是我自己找出的一组比较合理的值WVGA:480*800,屏幕密度240:当字体为22sp时,baseline=35px=basicline, lineHight=39px=linedistance;当字体为21sp时,baseline=34px=basicline, lineHight=38px=linedistance;当字体为20sp时,baseline=32px=basicline, lineHight=35px=linedistance;当字体为19sp时,baseline=31px
阅读全文
摘要:// 获取屏幕密度(方法1)intscreenWidth = getWindowManager().getDefaultDisplay().getWidth();// 屏幕宽(像素,如:480px)intscreenHeight = getWindowManager().getDefaultDisplay().getHeight();// 屏幕高(像素,如:800p)Log.e(TAG +" getDefaultDisplay","screenWidth="+ screenWidth +"; screenHeight="+ scree
阅读全文
摘要:只需把代码copy进入oncreate方法即可运行Java代码RelativeLayoutrl=newRelativeLayout(this);Buttonbtn1=newButton(this);btn1.setText("----------------------");btn1.setId(1);RelativeLayout.LayoutParamslp1=newRelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);lp1
阅读全文