Composable النص
اعرض سلسلة نصية وتحكم في أساسياتها
Composable النص درس مجاني في Jetpack Compose Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Jetpack Compose Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Jetpack Compose Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Meet Text
In Compose, you put words on screen with the Text composable. It is the simplest building block you will use in almost every screen.
Pass a String
Give Text a string and it renders instantly. No XML, no findViewById, just a function call describing what you want shown.
Text("Hello, Compose!")It Is Just a Function
Text is a composable function, not a class you inflate. You call it inside other composables, exactly like calling any Kotlin function. 🙂
Where Text Lives
You write Text inside a composable function such as your screen. Compose reads your code top to bottom and draws each element it finds.
@Composable
fun Greeting() {
Text("Welcome")
}Default Styling
With no extra arguments, Text uses sensible defaults from your theme: a readable size, the on-surface color, and the standard font.
Strings from Resources
For real apps, pull text from stringResource instead of hardcoding. This keeps your app translatable into every language you ship.
Text(stringResource(R.string.greeting))Combine with Variables
Because it is plain Kotlin, you can build the string from variables and templates before passing it to Text. Logic and UI live together.
val name = "Ada"
Text("Hi, " + name)Many Texts, One Screen
Need several lines? Just call Text multiple times. Each call is one independent element you can style on its own later.
maxLines Keeps It Tidy
Long content can be capped with maxLines so a label never grows taller than you expect. It simply stops drawing extra lines.
Text("A very long bio...", maxLines = 1)Reacts to State
When the string you pass changes, Text redraws automatically. You never call an update method; Compose tracks the value for you.
Your First Words
That is the whole idea: describe the text you want, and Compose paints it. Everything fancier is just extra arguments on this same call.
Quick Check
Which line correctly shows a greeting in Compose?
Recap
You met Text, the core composable for showing words. Pass it a string, lean on theme defaults, and it redraws whenever the value changes. 🎉
الأسئلة الشائعة
هل درس «Composable النص» مجاني؟
نعم — نص درس «Composable النص» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Jetpack Compose Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Jetpack Compose Academy 4 دروس في المجموع.
ماذا ستتعلم في «Composable النص»؟
اعرض سلسلة نصية وتحكم في أساسياتها تتمرن على Jetpack Compose Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Jetpack Compose Academy؟
لا تُشترط خبرة سابقة. Jetpack Compose Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.
كم من الوقت يستغرق درس «Composable النص»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Jetpack Compose Academy هذا؟
نعم. كل درس في Jetpack Compose Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.