내 프로젝트에서 및 Bold
에 TextView
스타일을 토글해야합니다. TextView
굵게 있지 않을 때 잘 작동동적으로 TextView 스타일을 전환 할 수 없습니다.
mTitleTextView.setTypeface(mTitleTextView.getTypeface(), letterItem.isRead() ? Typeface.NORMAL : Typeface.BOLD);
: 여기에 코드입니다. 그러나 현재 상태가 굵게 표시되면 정상 상태로 돌아 가지 않습니다.
mTitleTextView.setTypeface(null, letterItem.isRead() ? Typeface.NORMAL : Typeface.BOLD);
위의 행에서 문제가 해결되었지만 사용자 지정 글꼴을 사용하고 현재 서체에 null을 전달하면 글꼴이 제거됩니다.
mTitleTextView.setTypeface (mTitleTextView.getTypeface을 (변경됩니다), Typeface.NORMAL을); try mTitleTextView.invalidate(); –