darshan
darshan

Reputation: 4579

Custom Preference with AndroidX Preference

Before AndroidX,
I would override the Preference's onCreateView(ViewGroup parent) method to pass Custom Layouts to be used as Preference.

But in AndroidX's Preference, there is no onCreateView(ViewGroup parent) method but it instead has onBindViewHolder(PreferenceViewHolder holder), I am not sure how to pass custom layouts & use them instead..

Any help would be highly appreciated!
Thanks!

Upvotes: 4

Views: 3398

Answers (1)

Martin Zeitler
Martin Zeitler

Reputation: 76849

One has to assign it in the constructor already:

this.setLayoutResource(R.layout.preferences);

Here are some examples for onBindViewHolder().

Upvotes: 2

Related Questions