📅  最后修改于: 2023-12-03 15:13:20.636000             🧑  作者: Mango
Android Studio is an integrated development environment (IDE) designed specifically for developing Android applications. In this article, we will see how to use Android Studio to implement a Textview and change the font size.
First, let's create a new project in Android Studio.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
This code will create a Textview with the text "Hello World!".
To change the font size of the Textview, we need to add the following code to the "TextView" tag:
android:textSize="30sp"
This code will set the font size of the Textview to 30sp.
The final code for the "activity_main.xml" file will look like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:textSize="30sp" />
</RelativeLayout>
In this article, we learned how to create a Textview and change the font size using Android Studio. Android Studio provides an easy-to-use interface for developers to create and customize their Android applications. With these skills, you can create engaging and user-friendly applications for your users.