Android - Custom font - Viết chữ thư pháp trên Android Studio

Bước 1: Tạo resource
Đầu tiên tải font về để sử dụng:
http://fontchu.com/font/categories/VNI/VNI-Thuphap1.ttf
Trong thư mục của project tìm đến app-->src--> main, trong main ta tạo một thư mục tên assets. Trong assets tạo thêm một thư mục fonts, copy font vào thư mục fonts

Bước 2: Sử dụng font trong activity

Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/your_font_name.ttf");

Ví dụ sử dụng font cho textView:

tv.setTypeface(custom_font );

http://stackoverflow.com/questions/27588965/how-to-use-custom-font-in-android-studio

Nhận xét

Bài đăng phổ biến từ blog này

Android - Date Time - Lấy giá trị ngày, giờ theo định dạng tùy biến trong Android Studio

Android - Custom SearchView - Tạo khung tìm kiếm đơn giản trong Android Studio

Android - Image - Take Photo, Choose Photo from Gallery - Xử lý chụp ảnh, lấy ảnh trong Android Studio