Android XR SDK এখন ডেভেলপার প্রিভিউতে উপলব্ধ। আমরা আপনার প্রতিক্রিয়া চাই! পৌঁছানোর জন্য আমাদের
সমর্থন পৃষ্ঠা দেখুন।
আপনার অ্যাপে একটি সাবস্পেস যোগ করুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি সাবস্পেস হল আপনার অ্যাপের মধ্যে 3D স্পেসের একটি পার্টিশন যেখানে আপনি 3D মডেল স্থাপন করতে পারেন, 3D লেআউট তৈরি করতে পারেন এবং অন্যথায় 2D সামগ্রীতে গভীরতা যোগ করতে পারেন। স্থানিককরণ সক্ষম হলেই একটি সাবস্পেস রেন্ডার করা হয়। হোম স্পেস বা নন-এক্সআর ডিভাইসে, সেই সাবস্পেসের মধ্যে যেকোন কোড উপেক্ষা করা হয়।
আপনি 3D মডেল স্থাপনের জন্য সাবস্পেস কম্পোজেবল যেমন Volume
এবং SpatialPanel
ব্যবহার করতে পারেন। কিছু XR উপাদান যেমন Orbiter
বা SpatialDialog
হল প্রমিত 2D কম্পোজেবল যা আপনার 2D UI অনুক্রমের যেকোনো জায়গায় ব্যবহার করা যেতে পারে, তবে SubspaceComposable
s অবশ্যই আপনার অ্যাপের সাবস্পেসে ব্যবহার করতে হবে। এটি করার জন্য, হয় ApplicationSubspace
কম্পোজেবল বা Subspace
কম্পোজেবল ব্যবহার করুন।
নাম অনুসারে, ApplicationSubspace
কম্পোজেবলে আপনার অ্যাপের সমস্ত স্থানিক সামগ্রী থাকা উচিত। Subspace
কম্পোজেবল আপনার অ্যাপের বিদ্যমান UI অনুক্রমের গভীরে 3D স্পেসের একটি পার্টিশন নেস্ট করার জন্য আদর্শ।
অন্য যেকোনো কম্পোজেবলের মতো, আপনি সরাসরি আপনার 2D UI অনুক্রমের মধ্যে Subspace
কল করতে পারেন। যাইহোক, আপনি Subspace
ক্রমানুসারে কোথায় ব্যবহার করেন তার প্রভাব সম্পর্কে সচেতন হওয়া গুরুত্বপূর্ণ।
সাবস্পেস শ্রেণিবিন্যাস সম্পর্কে
শীর্ষ-স্তরের সাবস্পেস হল আপনার অ্যাপের দ্বারা আমন্ত্রিত সবচেয়ে বাইরের সাবস্পেস। আপনার টপ-লেভেল সাবস্পেসের জন্য ApplicationSubspace
কম্পোজেবল ব্যবহার করুন, কিন্তু, আপনি যদি শুধুমাত্র আপনার অ্যাপে সাবস্পেস কম্পোজেবল ব্যবহার করেন, তাহলে সবচেয়ে বাইরের Subspace
কম্পোজেবল হবে আপনার টপ-লেভেল সাবস্পেস। ডিফল্টরূপে, এই শীর্ষ-স্তরের সাবস্পেসটি একটি অ্যাপ দেখার জন্য প্রস্তাবিত স্থান দ্বারা আবদ্ধ থাকে এবং এটি সাধারণত যেখানে আপনি আপনার অ্যাপের স্থানিক বিন্যাস এবং SpatialPanel
রাখেন৷ আপনি যদি টপ-লেভেল সাবস্পেসের সীমানা পরিবর্তন করতে চান, তাহলে আপনার ApplicationSubspace
এ বিভিন্ন VolumeConstraints
পাস করুন।
যাইহোক, আপনি যদি টপ-লেভেল সাবস্পেসে থাকা একটি প্যানেলে 2D UI অনুক্রমের ভিতরে অন্য একটি সাবস্পেস নেস্ট করেন, সেই নেস্টেড সাবস্পেস ভিন্নভাবে আচরণ করে।
নেস্টেড সাবস্পেসের শীর্ষ-স্তরের Subspace
থেকে দুটি মূল পার্থক্য রয়েছে:
- তারা 2D লেআউটে অংশগ্রহণ করে যেখানে তাদের আহ্বান করা হয়। এর মানে হল সাবস্পেসের উচ্চতা এবং প্রস্থ তার 2D প্যারেন্ট লেআউটের উচ্চতা এবং প্রস্থ দ্বারা সীমাবদ্ধ হবে।
- তারা সেই সত্তার সন্তান হিসাবে আচরণ করে যেটিতে তারা আমন্ত্রিত হয়েছে৷ এর অর্থ হল, আপনি যদি একটি
Subspace
SpatialPanel
ভিতরে কম্পোজেবল নেস্টেড কল করেন, তাহলে সেই সাবস্পেসটি হল SpatialPanel
একটি শিশু এটিকে বলা হয়৷
নেস্টেড সাবস্পেসের এই আচরণগুলি সক্ষম করে যেমন:
- পিতামাতার সত্তার সাথে সন্তানকে স্থানান্তর করা
- অফসেট
SubspaceModifier
ব্যবহার করে সন্তানের অবস্থান অফসেট করা - একটি 3D অবজেক্ট উপস্থাপন করা যা আপনার 2D UI এর উপরে ঘোরাফেরা করে এবং 2D লেআউটে উপযুক্ত স্থানের উচ্চতা এবং প্রস্থের সাথে মেলে
আপনার অ্যাপে একটি সাবস্পেস যোগ করুন
নিম্নলিখিত কোড উদাহরণ দেখায় কিভাবে আপনার অ্যাপে শীর্ষ-স্তরের এবং নেস্টেড সাবস্পেস যোগ করতে হয়:
setContent {
// This is a top-level subspace
ApplicationSubspace {
SpatialPanel {
MyComposable()
}
}
}
@Composable
private fun MyComposable() {
Row {
PrimaryPane()
SecondaryPane()
}
}
@Composable
private fun PrimaryPane() {
// This is a nested subspace, because PrimaryPane is in a SpatialPanel
// and that SpatialPanel is in a top-level Subspace
Subspace {
ObjectInAVolume(true)
}
}
এই পৃষ্ঠার কন্টেন্ট ও কোডের নমুনাগুলি Content License-এ বর্ণিত লাইসেন্সের অধীনস্থ। Java এবং OpenJDK হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-23 UTC-তে শেষবার আপডেট করা হয়েছে।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-08-23 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Add a subspace to your app\n\nA subspace is a partition of 3D space within your app where you can place 3D\nmodels, build 3D layouts, and add depth to otherwise 2D content. A subspace is\nrendered only when spatialization is enabled. In Home Space or on non-XR\ndevices, any code within that subspace is ignored.\n\nYou can use subspace composables such as [`Volume`](/reference/kotlin/androidx/xr/compose/subspace/package-summary#Volume(androidx.xr.compose.subspace.layout.SubspaceModifier,kotlin.Function1)) and [`SpatialPanel`](/reference/kotlin/androidx/xr/compose/subspace/package-summary#SpatialPanel(androidx.xr.compose.subspace.layout.SubspaceModifier,androidx.xr.compose.subspace.layout.SpatialShape,kotlin.Function0))\nfor placing 3D models. Some XR components such as [`Orbiter`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#Orbiter(androidx.xr.compose.spatial.ContentEdge.Horizontal,androidx.compose.ui.unit.Dp,androidx.xr.compose.spatial.OrbiterOffsetType,androidx.compose.ui.Alignment.Horizontal,androidx.xr.compose.subspace.layout.SpatialShape,androidx.compose.ui.unit.Dp,kotlin.Boolean,kotlin.Function0)) or\n[`SpatialDialog`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#SpatialDialog(kotlin.Function0,androidx.xr.compose.spatial.SpatialDialogProperties,kotlin.Function0)) are standard 2D composables that can be used anywhere in\nyour 2D UI hierarchy, but [`SubspaceComposable`](/reference/kotlin/androidx/xr/compose/subspace/SubspaceComposable)s must be invoked in your\napp's subspace. To do this, use either the `ApplicationSubspace` composable or\nthe [`Subspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#Subspace(kotlin.Function1)) composable.\n\nAs the name suggests, the [`ApplicationSubspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#ApplicationSubspace(androidx.xr.compose.unit.VolumeConstraints,androidx.xr.compose.spatial.ConstraintsBehavior,kotlin.Function1)) composable should contain\nall of your app's spatialized content. The [`Subspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#Subspace(kotlin.Function1)) composable is ideal\nfor nesting a partition of 3D space deeper in your app's existing UI hierarchy.\n\nAs with any other composable, you can call [`Subspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#Subspace(kotlin.Function1)) directly in your 2D\nUI hierarchy. However, it's important to be aware of the implications of where\nin the hierarchy you invoke [`Subspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#Subspace(kotlin.Function1)).\n\nAbout subspace hierarchies\n--------------------------\n\nThe top-level subspace is the outermost subspace invoked by your app. Use the\n[`ApplicationSubspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#ApplicationSubspace(androidx.xr.compose.unit.VolumeConstraints,androidx.xr.compose.spatial.ConstraintsBehavior,kotlin.Function1)) composable for your top-level subspace, but, if you\nonly use the Subspace composable in your app, the outermost `Subspace`\ncomposable will be your top-level subspace. By default, this top-level subspace\nis bounded by the recommended space for viewing an app, and it's typically where\nyou place your app's spatial layout and [`SpatialPanel`](/reference/kotlin/androidx/xr/compose/subspace/package-summary#SpatialPanel(androidx.xr.compose.subspace.layout.SubspaceModifier,androidx.xr.compose.subspace.layout.SpatialShape,kotlin.Function0)). If you need to\nchange the bounds of the top-level subspace, pass different\n[`VolumeConstraints`](/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints) to your [`ApplicationSubspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#ApplicationSubspace(androidx.xr.compose.unit.VolumeConstraints,androidx.xr.compose.spatial.ConstraintsBehavior,kotlin.Function1)).\n\nHowever, if you nest another subspace inside of a 2D UI hierarchy in a panel\nthat's contained in the top-level subspace, that nested subspace behaves\ndifferently.\n\nNested subspaces have two key differences from top-level [`Subspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#Subspace(kotlin.Function1)):\n\n- They participate in the 2D layout in which they are invoked. This means that the height and width of the subspace will be constrained by the height and width of its 2D parent layout.\n- They behave as children of the entity they're invoked in. This means that, if you call a [`Subspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#Subspace(kotlin.Function1)) composable nested inside of a [`SpatialPanel`](/reference/kotlin/androidx/xr/compose/subspace/package-summary#SpatialPanel(androidx.xr.compose.subspace.layout.SubspaceModifier,androidx.xr.compose.subspace.layout.SpatialShape,kotlin.Function0)), that subspace is a child of the [`SpatialPanel`](/reference/kotlin/androidx/xr/compose/subspace/package-summary#SpatialPanel(androidx.xr.compose.subspace.layout.SubspaceModifier,androidx.xr.compose.subspace.layout.SpatialShape,kotlin.Function0)) it's called in.\n\nThese behaviors of nested subspace enable capabilities such as:\n\n- Moving the child with the parent entity\n- Offsetting the location of the child using the offset [`SubspaceModifier`](/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier)\n- Presenting a 3D object that hovers above your 2D UI and matches the height and width of the appropriate space in the 2D layout\n\nAdd a subspace to your app\n--------------------------\n\nThe following code example shows how to add top-level and nested subspaces to\nyour app:\n\n\n```kotlin\nsetContent {\n // This is a top-level subspace\n ApplicationSubspace {\n SpatialPanel {\n MyComposable()\n }\n }\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/xr/src/main/java/com/example/xr/compose/Subspace.kt#L34-L41\n```\n\n\u003cbr /\u003e\n\n\n```kotlin\n@Composable\nprivate fun MyComposable() {\n Row {\n PrimaryPane()\n SecondaryPane()\n }\n}\n\n@Composable\nprivate fun PrimaryPane() {\n // This is a nested subspace, because PrimaryPane is in a SpatialPanel\n // and that SpatialPanel is in a top-level Subspace\n Subspace {\n ObjectInAVolume(true)\n }\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/xr/src/main/java/com/example/xr/compose/Subspace.kt#L47-L62\n```\n\n\u003cbr /\u003e"]]