当项目中使用动态适配后,出现代码中使用setTextSize重新设置字体大小无效的情况。
经排查后发现,设置textSize后动态适配又重新将布局中的大小覆盖了代码中的大小。
因此在动态设置setTextSize前,只需重新设置TextView的layoutParam
RelativeLayout.LayoutParams layoutParams =(RelativeLayout.LayoutParams)textView.getLayoutParams();
textView.setLayoutParams(new RelativeLayout.LayoutParams(layoutParams));