TAILIEUCHUNG - Lập trình Androi part 19

Khi bạn đang phát triển bất kỳ loại ứng dụng, chắc chắn, bạn sẽ nhận được các câu hỏi, "Này, chúng ta có thể thay đổi font?" Câu trả lời tùy thuộc vào phông chữ đi kèm với nền tảng này, cho dù bạn có thể thêm phông chữ khác, và làm thế nào để áp dụng chúng cho các phụ tùng hoặc bất cứ điều gì cần thay đổi font chữ | Chapter Fonts When you re developing any types of applications inevitably you ll get the question Hey can we change this font The answer depends on which fonts come with the platform whether you can add other fonts and how to apply them to the widget or whatever needs the font change. Fonts in Android applications are no different. Android comes with some fonts plus a means for adding new fonts. But as with any new environment there are a few idiosyncrasies to deal with as you ll learn in this chapter. Love the One You re With Android natively knows three fonts by the shorthand names of sans serif and monospace . These fonts are actually the Droid series of fonts created for the Open Handset Alliance by Ascender http . To use these fonts you can just reference them in your layout XML such as the following layout from the Fonts FontSampler sample project xml version encoding utf-8 TableLayout xmlns android http apk res android android layout_width fill_parent android layout_height fill_parent android stretchColumns 1 TableRow TextView android text sans android layout_marginRight 4px android textSize 20sp TextView android id @ id sans android text Hello world android typeface sans android textSize 20sp TableRow TableRow 137 CHAPTER 12 Fonts TextView android text serif android layout_marginRight 4px android textSize 20sp TextView android id @ id serif android text Hello world android typeface serif android textSize 20sp TableRow TableRow TextView android text monospace android layout_marginRight 4px android textSize 20sp TextView android id @ id monospace android text Hello world android typeface monospace android textSize 20sp TableRow TableRow TextView android text Custom android layout_marginRight 4px android textSize 20sp TextView android id @ id custom android text Hello world android textSize 20sp TableRow TableLayout This layout builds a table showing short samples of the four fonts. Notice how the first .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.