Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

LeanbackPreferenceFragmentCompat

abstract class LeanbackPreferenceFragmentCompat : BaseLeanbackPreferenceFragmentCompat
kotlin.Any
   ↳ androidx.fragment.app.Fragment
   ↳ androidx.preference.PreferenceFragmentCompat
   ↳ androidx.leanback.preference.BaseLeanbackPreferenceFragmentCompat
   ↳ androidx.leanback.preference.LeanbackPreferenceFragmentCompat

This fragment provides a fully decorated leanback-style preference fragment, including a list background and header.

The following sample code shows a simple leanback preference fragment that is populated from a resource. The resource it loads is:

{@sample frameworks/support/samples/SupportPreferenceDemos/src/main/res/xml/preferences.xml * preferences}

The fragment needs only to implement onCreatePreferences(Bundle, String) to populate the list of preference objects:

{@sample frameworks/support/samples/SupportPreferenceDemos/src/main/java/com/example/android/supportpreference/FragmentSupportPreferencesLeanback.java * support_fragment_leanback} support_fragment_leanback}

Summary

Inherited constants
Public constructors

Public methods
open Unit
onViewCreated(@NonNull view: View, savedInstanceState: Bundle?)

open Unit

Set the title to be shown above the preference list

open View?
onCreateView(@NonNull inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?)

Inherited functions

Public constructors

<init>

LeanbackPreferenceFragmentCompat()

Public methods

onViewCreated

open fun onViewCreated(@NonNull view: View, savedInstanceState: Bundle?): Unit

setTitle

open fun setTitle(title: CharSequence!): Unit

Set the title to be shown above the preference list

Parameters
title CharSequence!: Title text to be shown

onCreateView

open fun onCreateView(@NonNull inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?