getTextWidths method is giving wrong result

There is a problem with some Paint class methods. I should get the width of spanned string given to the TextView. Let's say I'm measuring text at first row. When I measure it programmatically it gives **286**, but the width of the screen is **240**? Maybe someone had such a problem?Any help will be appreciated... The code for calculating width of spanned text: private int calcWidthSize(CharSequence spannedString, int currentSize) { int res = 0; Paint paint = new Paint(); float[] a= new float[444]; paint.setTextSize(currentSize); paint.getTextWidths(spannedString,0,spannedString.length(),a); for (int num=0;num

以上就是getTextWidths method is giving wrong result的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » HTML5 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准