In PreferenceFragment, the view is inflated like so
addPreferencesFromResource(R.xml.preferences);
and not by creating a view object and inflating it. So now, if I want to implement a toolbar in my settings fragment, which extends PreferenceFragment, I need to do this:
addPreferencesFromResource(R.xml.preferences);
toolbar = (Toolbar) findViewById(R.id.toolbar);
((ActionBarActivity)getActivity()).setSupportActionBar(toolbar);
but without a view object, how am I supposed to use findViewById?
No comments:
Post a Comment