সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
আপনি একটি বোতাম প্রদর্শন করতে পারেন যাতে একজন ব্যবহারকারীকে একটি তালিকার একটি নির্দিষ্ট পয়েন্টে স্ক্রোল করতে দেয়, সময় বাঁচায় এবং ব্যবহারকারীর ব্যস্ততা বৃদ্ধি পায়।
সংস্করণ সামঞ্জস্য
এই বাস্তবায়নের জন্য আপনার প্রজেক্ট minSDK এপিআই লেভেল 21 বা তার উপরে সেট করা প্রয়োজন।
নির্ভরতা
স্ন্যাপ স্ক্রলিং সক্ষম করতে একটি বোতাম তৈরি করুন৷
10টি আইটেম সহ একটি উল্লম্ব অলস তালিকায় মসৃণ স্ন্যাপ স্ক্রল করার জন্য একটি বোতাম তৈরি করতে নিম্নলিখিত কোডটি ব্যবহার করুন:
এই পৃষ্ঠার কন্টেন্ট ও কোডের নমুনাগুলি Content License-এ বর্ণিত লাইসেন্সের অধীনস্থ। Java এবং OpenJDK হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-02-06 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-02-06 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Create a button to enable snap scrolling\n\n\u003cbr /\u003e\n\nYou can display a button to let a user snap scroll to a specific point in a\nlist, saving time and increasing user engagement.\n\nVersion compatibility\n---------------------\n\nThis implementation requires that your project minSDK be set to API level 21 or\nhigher.\n\n### Dependencies\n\n### Kotlin\n\n\u003cbr /\u003e\n\n```kotlin\n implementation(platform(\"androidx.compose:compose-bom:2025.08.00\"))\n implementation(\"androidx.compose.material3:material3\")\n \n```\n\n\u003cbr /\u003e\n\n### Groovy\n\n\u003cbr /\u003e\n\n```groovy\n implementation platform('androidx.compose:compose-bom:2025.08.00')\n implementation 'androidx.compose.material3:material3'\n \n```\n\n\u003cbr /\u003e\n\nCreate a button to enable snap scrolling\n----------------------------------------\n\nUse the following code to create a button for smooth snap scrolling in a\nvertical lazy list with 10 items:\n\n\n```kotlin\n@Composable\nfun MessageList(modifier: Modifier = Modifier) {\n val listState = rememberLazyListState()\n val coroutineScope = rememberCoroutineScope()\n\n LazyColumn(state = listState, modifier = Modifier.height(120.dp)) {\n items(10) { index -\u003e\n Text(\n modifier = Modifier.height(40.dp),\n text = \"Item $index\"\n )\n }\n }\n\n Button(onClick = {\n coroutineScope.launch {\n listState.animateScrollToItem(index = 0)\n }\n }) {\n Text(text = \"Go top\")\n }\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/compose/snippets/src/main/java/com/example/compose/snippets/lists/LazyListSnippets.kt#L810-L831\n```\n\n\u003cbr /\u003e\n\n### Key points about the code\n\n- Uses the [`listState`](/reference/kotlin/androidx/compose/foundation/lazy/LazyListState) object to remember the scroll state of [`LazyColumn`](/reference/kotlin/androidx/compose/foundation/lazy/package-summary#LazyColumn(androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.LazyListState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,kotlin.Function1)) to the selected position.\n- Launches a coroutine to call [`listState.animateScrollToItem`](/reference/kotlin/androidx/compose/foundation/lazy/LazyListState#animateScrollToItem(kotlin.Int,kotlin.Int)), which scrolls to the indexed item while animating the scrolling action.\n\nResults\n-------\n\n**Figure 1.** A vertical scrolling list with a snap scroll button.\n\nCollections that contain this guide\n-----------------------------------\n\nThis guide is part of these curated Quick Guide collections that cover\nbroader Android development goals: \n\n### Display a list or grid\n\nLists and grids allow your app to display collections in a visually pleasing form that's easy for users to consume. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/display-a-list-or-grid) \n\n### Display interactive components\n\nLearn how composable functions can enable you to easily create beautiful UI components based on the Material Design design system. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/display-interactive-components) \n\n### Compose basics (video collection)\n\nThis series of videos introduces various Compose APIs, quickly showing you what's available and how to use them. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/compose-basics) \n\nHave questions or feedback\n--------------------------\n\nGo to our frequently asked questions page and learn about quick guides or reach out and let us know your thoughts. \n[Go to FAQ](/quick-guides/faq) [Leave feedback](https://issuetracker.google.com/issues/new?component=1573691&template=1993320)"]]