I\'m trying to add toolbars to the AppCompatPreferenceActivity but I don\'t know how to do so.
Can you tell me how?
Use PreferenceFragment, You can do like this in your activity:
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new MyPreferenceFragment()).commit();
And the MyPreferenceFragment like this:
public class MyPreferenceFragment extends PreferenceFragment{
@Override
public void onCreate(final Bundle savedInstanceState){
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
}
}
Hope this helped!