これを試して :
String.xml
<string name="foobar"><small>Foo</small>\nBar</string>
活動中
final TextView mytext = (TextView) findViewById(R.id.my_textView);
mytext.setText(getString(R.string.foobar));
Button btn_getTextBounds = (Button) findViewById(R.id.ok);
btn_getTextBounds.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Rect rectf = new Rect();
mytext.getLocalVisibleRect(rectf);
Log.d("WIDTH :",String.valueOf(rectf.width()));
Log.d("HEIGHT :",String.valueOf(rectf.height()));
Log.d("left :",String.valueOf(rectf.left));
Log.d("right :",String.valueOf(rectf.right));
Log.d("top :",String.valueOf(rectf.top));
Log.d("bottom :",String.valueOf(rectf.bottom));
}
});
表示画面領域のTextViewで使用される必要な属性が表示されます。
お役に立てば幸いです。
ありがとう。