Android 代码设置TextView文字大小
在Java代码中,可以使用setTextSize()方法来设置TextView的文字大小,例如:
TextView textView = findViewById(R.id.text_view);
textView.setTextSize(18); // 设置文字大小为18sp
在XML布局文件中,可以在TextView标签中使用android:textSize属性来设置文字大小,例如:
<TextView
android:id="@+id/text_view"
android:text="Hello World!"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
原文地址: https://www.cveoy.top/t/topic/fEAe 著作权归作者所有。请勿转载和采集!