摘要: 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 阅读全文
posted @ 2012-04-18 17:33 爱吃糖的糖宝宝 阅读(1646) 评论(0) 推荐(0)
摘要: // 获取屏幕密度(方法1)intscreenWidth = getWindowManager().getDefaultDisplay().getWidth();// 屏幕宽(像素,如:480px)intscreenHeight = getWindowManager().getDefaultDisplay().getHeight();// 屏幕高(像素,如:800p)Log.e(TAG +" getDefaultDisplay","screenWidth="+ screenWidth +"; screenHeight="+ scree 阅读全文
posted @ 2012-04-12 20:37 爱吃糖的糖宝宝 阅读(834) 评论(0) 推荐(0)
摘要: 只需把代码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 阅读全文
posted @ 2012-04-12 20:28 爱吃糖的糖宝宝 阅读(872) 评论(0) 推荐(0)
摘要: 我原本使用SimpleAdapter,这样的点击ListView的ImageView的话不能响应点击事件,因为要在同一个Activity中用到两个layout,所以需要重新写一个Adapter,继承BaseAdapter,复写其中的一些方法,在getView方法中才能用这个ImageView的onC 阅读全文
posted @ 2012-03-30 17:27 爱吃糖的糖宝宝 阅读(1689) 评论(0) 推荐(0)