ตัวกำหนดรูปแบบตัวอักษรและรูปทรง
รวมศูนย์แบบอักษรและรูปแบบมุม
ตัวกำหนดรูปแบบตัวอักษรและรูปทรง เป็นบทเรียน Jetpack Compose Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Jetpack Compose Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Jetpack Compose Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Fonts Get a Theme Too
Just like colors, your text styles live in the theme. The typography slot of MaterialTheme defines every font size, weight, and spacing in one place. 🔤
A Type Scale
Material gives you a ready-made type scale: named roles like headline, title, body, and label that keep your text consistent across screens.
Named Text Styles
You reach a style by name, so a headlineLarge looks the same everywhere and updates app-wide when you tweak the theme once.
Text(
"Welcome",
style = MaterialTheme.typography.headlineLarge
)Body vs Title
Use bodyMedium for paragraphs and titleLarge for headers; picking the right role gives clear hierarchy without hand-tuning every size.
Customize a Style
You override a role with a copy, changing only what you need; here titleLarge keeps its size but gets a bolder weight.
val type = Typography(
titleLarge = TextStyle(fontWeight = FontWeight.Bold)
)Plug In a Font Family
Swap the default font by setting a fontFamily on your styles, so your brand typeface flows through every Text in the app.
TextStyle(fontFamily = brandFont)Shapes Are Tokens Too
Corners are themeable as well. The shapes slot defines how rounded your cards, buttons, and sheets look across the app.
Small, Medium, Large
Material 3 groups shapes into small, medium, and large tokens, and components automatically pick the size that fits them.
Define Your Corners
You set corner radii once in a Shapes object, and every component that uses that token instantly adopts the new roundness.
val shapes = Shapes(
medium = RoundedCornerShape(12.dp)
)Read a Shape Token
Apply a token directly to a Composable so it matches the theme; here a Surface clips itself with MaterialTheme.shapes.medium.
Surface(shape = MaterialTheme.shapes.medium) { /* card */ }Consistency by Default
Centralizing type and shape tokens means new screens look on-brand automatically, and a single edit restyles them all. ✨
Quick Check
You want every card to share the same corner radius app-wide. Where do you set it?
Recap: Type & Shape, Centralized
You styled text through the typography scale and rounded corners through shape tokens, so one theme keeps fonts and shapes consistent. 🎉
คำถามที่พบบ่อย
บทเรียน “ตัวกำหนดรูปแบบตัวอักษรและรูปทรง” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “ตัวกำหนดรูปแบบตัวอักษรและรูปทรง” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Jetpack Compose Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Jetpack Compose Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “ตัวกำหนดรูปแบบตัวอักษรและรูปทรง”
รวมศูนย์แบบอักษรและรูปแบบมุม คุณปฏิบัติ Jetpack Compose Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Jetpack Compose Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Jetpack Compose Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “ตัวกำหนดรูปแบบตัวอักษรและรูปทรง” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Jetpack Compose Academy นี้ได้ไหม
ได้ บทเรียน Jetpack Compose Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- MaterialTheme และชุดสี
- ตัวกำหนดรูปแบบตัวอักษรและรูปทรง
- โหมดมืดและสีแบบไดนามิก
- สร้างระบบการออกแบบแบบกำหนดเอง