0Pricing
Jetpack Compose Academy · درس

نموذج القياس والوضع

افهم تخطيط Compose ذي المرور الواحد

نموذج القياس والوضع درس مجاني في Jetpack Compose Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Jetpack Compose Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Jetpack Compose Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

When Built-In Layouts Are Not Enough

Column, Row, and Box cover most screens. But sometimes you need total control over where children go. That is when you build a custom layout. 🎨

Compose Lays Out in One Pass

Unlike the old View system, Compose measures and places everything in a single pass. There is no expensive measure-then-measure-again cycle.

Two Steps: Measure, Then Place

Every layout does two things in order. First it measures each child to learn its size. Then it places each child at a chosen position.

Measurables Are Children Not Yet Sized

A parent receives its children as measurables. A measurable is a child you have not measured yet, like a parcel before you weigh it. 📦

Measuring Produces a Placeable

Call measure on a measurable and you get a placeable back. The placeable knows its final width and height and is ready to be positioned.

val placeable = measurable.measure(constraints)
val w = placeable.width

Constraints Set the Size Limits

When you measure, you pass constraints: the min and max width and height the child is allowed. The child picks a size within those bounds.

Measure Each Child Exactly Once

The single-pass rule means you must measure each child only once. Measuring the same child twice throws an error at runtime.

The Parent Decides Its Own Size

After measuring children, the parent reports its own width and height. It usually sizes itself to wrap the children it just measured.

layout(width, height) {
  // place children here
}

Placing Sets Each Child's Position

Inside the layout block you call placeRelative on each placeable, giving it an x and y. That is where the child lands on screen.

placeable.placeRelative(x = 0, y = 0)

placeRelative Respects Direction

Prefer placeRelative over place. It automatically mirrors positions for right-to-left languages, so your layout works everywhere. 🌍

This Model Powers Every Layout

Column, Row, and your future custom layouts all follow this same measure-then-place rhythm. Learn it once and you understand all of Compose layout.

Quick Check

What do you get back after measuring a measurable?

Recap: The Measure & Place Model

Compose lays out in one pass: measure each child once within constraints to get placeables, then place them. This model drives every layout you will build. ✅

الأسئلة الشائعة

هل درس «نموذج القياس والوضع» مجاني؟

نعم — نص درس «نموذج القياس والوضع» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Jetpack Compose Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Jetpack Compose Academy 4 دروس في المجموع.

ماذا ستتعلم في «نموذج القياس والوضع»؟

افهم تخطيط Compose ذي المرور الواحد تتمرن على Jetpack Compose Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Jetpack Compose Academy؟

لا تُشترط خبرة سابقة. Jetpack Compose Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.

كم من الوقت يستغرق درس «نموذج القياس والوضع»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Jetpack Compose Academy هذا؟

نعم. كل درس في Jetpack Compose Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. نموذج القياس والوضع
  2. كتابة Composable للتخطيط
  3. القيود والقياسات الجوهرية
  4. ‏FlowRow يلتف حول الشرائح
← العودة إلى Jetpack Compose Academy