Android XR SDK এখন ডেভেলপার প্রিভিউতে উপলব্ধ। আমরা আপনার প্রতিক্রিয়া চাই! পৌঁছানোর জন্য আমাদের
সমর্থন পৃষ্ঠা দেখুন।
অ্যান্ড্রয়েড ভিউ-ভিত্তিক অ্যাপের জন্য UI ডেভেলপ করুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
রচনা পদ্ধতি চেষ্টা করুন
Jetpack XR SDK ব্যবহার করে জেটপ্যাক কম্পোজ করা হল Android XR-এর জন্য প্রস্তাবিত UI টুলকিট।
অ্যান্ড্রয়েড জেটপ্যাক কম্পোজ ফ্রেমওয়ার্ক ব্যবহার করা হল অ্যান্ড্রয়েড UI ডেভেলপমেন্টের সর্বশেষ অগ্রগতির সুবিধা নেওয়ার এবং আপনার অ্যাপ্লিকেশনটি শিল্পের সর্বোত্তম অনুশীলনের সাথে বর্তমান রয়েছে তা যাচাই করার সর্বোত্তম উপায়।
যাইহোক, আপনি যদি স্থানান্তরিত না হয়ে থাকেন এবং একটি অ্যান্ড্রয়েড ভিউ ভিত্তিক অ্যাপকে স্থানান্তরিত করার জন্য কাজ করছেন, তবে আপনি কিছু পন্থা অবলম্বন করতে পারেন।
SpatialPanels-এর মধ্যে আপনার বিদ্যমান ভিউ পুনরায় ব্যবহার করুন
যদিও SpatialPanel
XR লাইব্রেরির জন্য Jetpack Compose-এর অংশ, তারা ভিউও গ্রহণ করে। আপনার মেইনঅ্যাক্টিভিটিতে Subspace
ব্যবহার করার সময়, নিম্নলিখিত উদাহরণে দেখানো হিসাবে একটি SpatialPanel
প্যানেলে একটি বিদ্যমান ভিউ রাখুন।
setContent {
Subspace {
SpatialPanel(
modifier = SubspaceModifier.height(500.dp).width(500.dp).depth(25.dp)
) { MyCustomView(this@ActivityWithSubspaceContent) }
}
}
অ্যান্ড্রয়েড ভিউ এবং কম্পোজ ইন্টারঅপারেবিলিটি API ব্যবহার করুন
ভিউ এবং কম্পোজের মধ্যে ইন্টারঅপারেবিলিটি সম্পর্কে নির্দেশিকা দেখুন। এই ডকুমেন্টেশনটি এই ফ্রেমওয়ার্কগুলিকে একসাথে ব্যবহার করে কভার করে এবং আপনি ব্যবহার করতে পারেন এমন কোড নমুনার লিঙ্ক রয়েছে৷
একটি বিদ্যমান খণ্ডে স্থানিক প্যানেল এবং অরবিটার যোগ করতে একটি ComposeView ব্যবহার করুন
Composables যোগ করতে এবং নতুন XR সামগ্রী তৈরি করতে আপনার XML লেআউটে একটি ComposeView
ব্যবহার করুন। onCreateView()
ফাংশনে ComposeView
খুঁজে পেতে ভিউ বাইন্ডিং বা findViewById
ব্যবহার করুন।
ComposeView
নির্দেশিকা সম্পর্কে আরও পড়ুন ।
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val view = inflater.inflate(R.layout.example_fragment, container, false)
view.findViewById<ComposeView>(R.id.compose_view).apply {
// Dispose of the Composition when the view's LifecycleOwner
// is destroyed
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
// In Compose world
SpatialPanel(SubspaceModifier.height(500.dp).width(500.dp)) {
Text("Spatial Panel with Orbiter")
}
}
}
return view
}
জেটপ্যাক সিনকোর লাইব্রেরির সাথে সরাসরি কাজ করুন
XR-এর জন্য কম্পোজ জেটপ্যাক সিনকোরের উপরে তৈরি করা হয়েছে। আপনি যদি একটি ভিউ ভিত্তিক অ্যাপকে স্থানান্তরিত করে থাকেন, তাহলে আপনি XR-এর জন্য রচনার মধ্যে আপনার বিদ্যমান UI কোড ব্যবহার করা চালিয়ে যেতে পারেন বা এর পরিবর্তে Jetpack SceneCore-এর Session
সাথে সরাসরি কাজ করা বেছে নিতে পারেন।
আপনি PanelEntity
ব্যবহার করে SceneCore থেকে সরাসরি প্যানেল তৈরি করতে পারেন। dimensions
ব্যবহার করে মিটারে প্যানেলের আকার সেট করুন বা পিক্সেল মাত্রা ব্যবহার করে pixelDimensions
। আপনি সংশ্লিষ্ট উপাদানগুলি ব্যবহার করে প্যানেলগুলিকে চলমান বা পরিবর্তনযোগ্য করতে বেছে নিতে পারেন। আরও তথ্যের জন্য, সত্তাগুলিতে সাধারণ আচরণ যুক্ত করুন দেখুন।
val panelContent = MyCustomView(this)
val panelEntity = PanelEntity.create(
session = xrSession,
view = panelContent,
pixelDimensions = IntSize2d(500, 500),
name = "panel entity"
)
এই পৃষ্ঠার কন্টেন্ট ও কোডের নমুনাগুলি Content License-এ বর্ণিত লাইসেন্সের অধীনস্থ। Java এবং OpenJDK হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-28 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-28 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["Try the Compose way \nJetpack Compose using the Jetpack XR SDK is the recommended UI toolkit for Android XR. \n[Develop with the Jetpack XR SDK →](/develop/xr/jetpack-xr-sdk) \n\n\u003cbr /\u003e\n\nUsing the [Android Jetpack Compose framework](/jetpack/compose) is the best way to take\nadvantage of the latest advancements in Android UI development and to verify\nthat your application remains current with industry best practices.\n\nHowever, if you haven't migrated, and are working to spatialize an [Android\nViews](/develop/ui/views/layout/declaring-layout) based app, there are a few approaches you can take.\n\nReuse your existing Views within SpatialPanels\n\nWhile [`SpatialPanel`s](/reference/kotlin/androidx/xr/compose/subspace/package-summary#SpatialPanel(androidx.xr.compose.subspace.layout.SubspaceModifier,androidx.xr.compose.subspace.layout.SpatialShape,kotlin.Function0)) are part of the Jetpack Compose for XR library, they\nalso accept Views. When using [`Subspace`](/reference/kotlin/androidx/xr/compose/spatial/package-summary#Subspace(kotlin.Function1)) in your MainActivity,\nplace an existing view into 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)) as shown in the following\nexample.\n\n\n```kotlin\nsetContent {\n Subspace {\n SpatialPanel(\n modifier = SubspaceModifier.height(500.dp).width(500.dp).depth(25.dp)\n ) { MyCustomView(this@ActivityWithSubspaceContent) }\n }\n}https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/xr/src/main/java/com/example/xr/compose/Views.kt#L48-L54\n```\n\n\u003cbr /\u003e\n\nUse Android Views and Compose interoperability APIs\n\nConsult [guidance on interoperability between Views and Compose](/develop/ui/compose/migrate/interoperability-apis). This\ndocumentation covers using these frameworks together and contains links to code\nsamples you can use.\n\nUse a ComposeView to add spatial panels and orbiters to an existing fragment\n\nUse a [`ComposeView`](/reference/kotlin/androidx/compose/ui/platform/ComposeView) in your XML layout to add Composables and create new XR\ncontent. Use [View binding](/topic/libraries/view-binding) or [`findViewById`](/reference/android/view/View#findViewById(int)) to find the\n[`ComposeView`](/reference/kotlin/androidx/compose/ui/platform/ComposeView) in the [`onCreateView()`](/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)) function.\n\n[Read more about `ComposeView` guidance](/develop/ui/compose/migrate/interoperability-apis/compose-in-views#compose-in-fragments).\n\n\n```kotlin\noverride fun onCreateView(\n inflater: LayoutInflater,\n container: ViewGroup?,\n savedInstanceState: Bundle?\n): View {\n val view = inflater.inflate(R.layout.example_fragment, container, false)\n view.findViewById\u003cComposeView\u003e(R.id.compose_view).apply {\n // Dispose of the Composition when the view's LifecycleOwner\n // is destroyed\n setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)\n setContent {\n // In Compose world\n SpatialPanel(SubspaceModifier.height(500.dp).width(500.dp)) {\n Text(\"Spatial Panel with Orbiter\")\n }\n }\n }\n return view\n}https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/xr/src/main/java/com/example/xr/compose/Views.kt#L61-L79\n```\n\n\u003cbr /\u003e\n\nWork directly with the Jetpack SceneCore library\n\n[Compose for XR](/develop/xr/jetpack-xr-sdk#jetpack-compose) is built on top of [Jetpack SceneCore](/develop/xr/jetpack-xr-sdk#jetpack-scenecore). If you are\nspatializing a Views based app, you may continue to use your existing UI code\nwithin Compose for XR or choose to work directly with Jetpack SceneCore's\n[`Session`](/reference/kotlin/androidx/xr/runtime/Session) instead.\n\nYou can build panels directly from SceneCore using [`PanelEntity`](/reference/kotlin/androidx/xr/scenecore/PanelEntity). Set the\nsize of the panel in meters using [`dimensions`](/reference/kotlin/androidx/xr/scenecore/PanelEntity#create(androidx.xr.runtime.Session,android.view.View,androidx.xr.runtime.math.FloatSize2d,kotlin.String,androidx.xr.runtime.math.Pose)), or in pixels using\n[`pixelDimensions`](/reference/kotlin/androidx/xr/scenecore/PanelEntity#create(androidx.xr.runtime.Session,android.view.View,androidx.xr.runtime.math.IntSize2d,kotlin.String,androidx.xr.runtime.math.Pose)). You can choose to make the panels movable or resizable\nby using the corresponding components. For more information, see [Add common\nbehavior to entities](/develop/xr/jetpack-xr-sdk/work-with-entities#add-common).\n\n\n```kotlin\nval panelContent = MyCustomView(this)\nval panelEntity = PanelEntity.create(\n session = xrSession,\n view = panelContent,\n pixelDimensions = IntSize2d(500, 500),\n name = \"panel entity\"\n)https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/xr/src/main/java/com/example/xr/compose/Views.kt#L85-L91\n```\n\n\u003cbr /\u003e"]]