What exactly is your problem here . getting line count 18 when u filled textbox with 18 lines?
On Sat, May 8, 2010 at 12:53 AM, Vincent Tsao <caojunvinc...@gmail.com>wrote: > @Soical Hub: thanks for your help, your suggestion inspired me a lot > > i finally find this way to get padding: *getCompoundPaddingTop()*, and it > works fine now > > what' more, i find another "tricky" way to meet my requirement: > > *Step 1: fill in the EditText with 18 'empty' line rows* > > StringBuilder sb = new StringBuilder(); > for (int i = 0; i < 18; i++) { > sb.append("\n"); > } > > * this.setText(sb.toString());* > > > *Step 2: draw those 18 lines > > * > * * @Override > > protected void onDraw(Canvas canvas) { > canvas.drawColor(paperColor); > * int count = getLineCount(); // that's the tricky part, now count > will return 18* > Rect r = mRect; > > for (int i = 0; i < count; i++) { > int baseline = getLineBounds(i, r); > > // Draw ruled lines > canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, > > linePaint); > > canvas.save(); > } > super.onDraw(canvas); > canvas.restore();** > * *} > > but i don't like this tricky way personally :) > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en