在Android应用中显示文字大小可以通过设置TextView的textSize属性来实现。
在布局文件中,可以通过如下代码设置TextView的字体大小:
```xml
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="20sp" /> ``` 在代码中动态设置文字大小也很简单,可以通过setTextSize()方法来实现: ```java TextView textView = findViewById(R.id.textView); textView.setText("Hello World!"); textView.setTextSize(20); ``` 其中,设置textSize属性时建议使用sp(缩放独立像素)作为单位,这样可以根据用户的系统字体大小做出适当的调整。