We are trying to position a widget at the cursor position on the edit
widget.
It seems this is only exposed in character position, not pixels.

This has been the work-around that we've comeup with - to paint the
text and
compute the rectangle extents. This seems a tad inefficient - but we
couldn't
find another way.

Would appreciate any help in finding better mechanisms to do the
same.

        EditText entry;

        String s = entry.getText().toString();
        TextPaint p = new TextPaint();
        p.setTextSize(entry.getTextSize());
        Rect r = new Rect();
        p.getTextBounds(s, 0, s.length(), r);
       // r.width() gives one the cursor position - after adding
appropriate offsets.

thanks,
-vivek

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to