Làm quen với Google Fonts dành cho Android
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Android O và Thư viện AndroidX thêm tính năng hỗ trợ cho
Phông chữ có thể tải xuống.
Google Fonts đang gửi một Trình cung cấp phông chữ trong Dịch vụ Google Play. Điều này có nghĩa là
Google Fonts có sẵn cho các ứng dụng gốc trên thiết bị Android!
Tôi có thể sử dụng phông chữ nào?
Toàn bộ bộ sưu tập nguồn mở của Google Fonts! Truy cập/ghé qua
https://fonts.google.com để duyệt qua.
Những phiên bản Android nào được hỗ trợ?
Nhà cung cấp của chúng tôi hỗ trợ Jelly Bean (API cấp 16) trở lên. Con số này chiếm hơn 95%
của các thiết bị Android
(trang tổng quan về nền tảng).
Có thể truy cập vào thư viện này bằng API trong Thư viện AndroidX
(androidx.core)
hoặc Android O (API cấp 26).
Làm cách nào tôi có thể bắt đầu!
Để yêu cầu phông chữ từ trình cung cấp Google Fonts, hãy sử dụng định dạng truy vấn sau:
Thông số |
Bắt buộc? |
Phạm vi |
Loại dữ liệu |
Giá trị mặc định |
tên |
Có |
Mọi gia đình trên font.google.com |
string |
|
chiều rộng |
Không |
> 0 |
số thực dấu phẩy động |
100 |
cân nặng |
Không |
Dành riêng cho (0, 1000) |
int |
400 |
in nghiêng |
Không |
[0, 1] cho tất cả mọi người |
số thực dấu phẩy động |
0 |
nỗ lực tối đa |
Không |
true/false |
boolean |
đúng |
Nếu nỗ lực là đúng và truy vấn của bạn chỉ định một họ hợp lệ nhưng
giá trị chiều rộng/trọng số/in nghiêng yêu cầu không được hỗ trợ, chúng tôi sẽ trả về giá trị chính xác nhất
phù hợp mà chúng tôi có thể tìm thấy trong gia đình. Ví dụ: yêu cầu cho
Oswald với trọng lượng 900 sẽ trả về
Oswald cân nặng 700.
Truy vấn mẫu:
name=Lobster # Lobster, 400 weight
name=Lato&weight=100 # Lato, 100 weight
name=Open Sans&weight=800&italic=1 # Open Sans, 800 weight, italic
Bảo mật
Để bảo mật, bạn phải chỉ định chữ ký của ứng dụng hiển thị
nhà cung cấp mà bạn muốn yêu cầu phông chữ. Android Studio sẽ thêm
chữ ký chính xác cho bạn. Xem
thêm chứng chỉ.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eAndroid now supports downloadable fonts, including the entire Google Fonts collection, via Android O and AndroidX Library.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Fonts are readily available for native Android apps through a Font Provider in Google Play Services, supporting Android Jelly Bean (API level 16) and above.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access Google Fonts declaratively or programmatically and easily customize font attributes like width, weight, and italic style.\u003c/p\u003e\n"],["\u003cp\u003eA built-in "best effort" feature ensures the closest font match if the specific requested style is unavailable within the chosen font family.\u003c/p\u003e\n"],["\u003cp\u003eFor security, applications utilizing the Google Fonts provider must specify the provider's signature, a process simplified within Android Studio.\u003c/p\u003e\n"]]],[],null,["# Get Started with the Google Fonts for Android\n\nAndroid O and AndroidX Library add support for\n[Downloadable Fonts](https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html).\n\nGoogle Fonts is shipping a Font Provider in Google Play Services. This means\nGoogle Fonts are available to native apps on Android devices!\n\nWhich fonts can I use?\n----------------------\n\nThe entire Google Fonts Open Source collection! Visit\n\u003chttps://fonts.google.com\u003e to browse.\n\nWhat versions of Android are supported?\n---------------------------------------\n\nOur provider supports Jelly Bean (API level 16) and up. This represents 95%+ of\nof Android devices in the wild\n([platform dashboard](https://developer.android.com/about/dashboards/index.html#Platform)).\nIt can be accessed using APIs in AndroidX Library\n([androidx.core](https://developer.android.com/jetpack/androidx/releases/core))\nor Android O (API level 26).\n\nHow can I get started!\n----------------------\n\n- Check out the [demo app](https://github.com/android/user-interface-samples/tree/main/DownloadableFonts).\n- Try it in Android Studio 3.0 ([walkthrough with screenshots](https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html#via-android-studio))\n- Use Google Fonts declaratively or programmatically as shown in [Downloadable Fonts](https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html).\n\nQuery Format\n------------\n\nTo request a font from the Google Fonts provider use the following query format:\n\n| Parameter | Required? | Range | Data Type | Default value |\n|------------|-----------|----------------------------------|-----------|---------------|\n| name | Yes | Any family from fonts.google.com | string | |\n| width | No | \\\u003e 0 | float | 100 |\n| weight | No | (0, 1000) exclusive | int | 400 |\n| italic | No | \\[0, 1\\] inclusive | float | 0 |\n| besteffort | No | true/false | boolean | true |\n\nIf besteffort is true and your query specifies a valid family name but the\nrequested width/weight/italic value is not supported we will return the best\nmatch we can find within the family. For example, a request for\n[Oswald](https://fonts.google.com/specimen/Oswald) at weight 900 would return\nOswald at weight 700.\n\nSample queries: \n\n name=Lobster # Lobster, 400 weight\n name=Lato&weight=100 # Lato, 100 weight\n name=Open Sans&weight=800&italic=1 # Open Sans, 800 weight, italic\n\nSecurity\n--------\n\nFor security you must specify the signature of the application exposing the\nprovider you want to request fonts from. Android Studio will add\nthe correct signature for you. See\n[adding certificates](https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html#adding-certificates)."]]