[img]https://i.sstatic. net/RIWsk.png[/img]
Я также включаю макет и код Java:
layout/ toolbar.xml
Код: Выделить всё
Код: Выделить всё
Код: Выделить всё
Код: Выделить всё
public class SettingsActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment()).commit();
TimePickerDialog timePicker = new TimePickerDialog(this);
PreferenceManager.setDefaultValues(this, R.xml.fragment_settings, false);
}
}
Код: Выделить всё
public class SettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.fragment_settings);
handleSettingsOptions();
}
....
}
Я использую один экран настроек, и каждое предпочтение открывает веб-просмотр.
Заранее благодарим за ответы.
Подробнее здесь: https://stackoverflow.com/questions/281 ... of-toolbar
Мобильная версия