textview cutting off a letter in android

前端 未结 11 2305
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-18 12:56

\"http://dl.dropbox.com/u/24856/Screenshots/android/cutoff.png\"

this is a screen shot from my android. the text is

11条回答
  •  再見小時候
    2021-02-18 13:27

    This is my solution: Format textview and measure. After that set width of textview with 1 pixel add to the width measured.

        TextView textView = new TextView(this);
        textView.setText("Text blah blah");
        textView.setTypeface(typeface, Typeface.BOLD_ITALIC)
        textView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
        textView.setLayoutParams(new LayoutParams(textView.getMeasuredWidth() + 1, LayoutParams.WRAP_CONTENT));
    

    Working for me. Hope these help.

提交回复
热议问题