android - How to get text's coordinate inside a TextView? -
i have situation:there 2 textviews, one's gravity left|centervertical , other's right|centervertical. when wraping them, texts must wrap positions exactly, left left ,right right. achive this, have coordinate of text inside textview, can calculate offset, how text's coordinate inside textview without inner padding?
i think there no solution text's coordinate inside textview without inner padding value.
if want text's coordinate, should calculate using view's location , inner padding value.
public float gettextpositionx(textview textview) { return textview.getx() + textview.getpaddingleft(); } public float gettextpositiony(textview textview) { return textview.gety() + textview.getpaddingtop(); }
Comments
Post a Comment