0
이것은 정말 이상하고 설명하기가 어렵습니다.뒤로 버튼이 제대로 응답하지 않습니다.
활동
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.e("hm", ""+ item.getItemId());
switch (item.getItemId()) {
case android.R.id.home:
Toast.makeText(Activity_Main.this, "back", Toast.LENGTH_SHORT).show();
onBackPressed();
return true;
case R.id.settings_toolbar:
Toast.makeText(Activity_Main.this, "setings", Toast.LENGTH_SHORT).show();
toSettings();
return true;
case R.id.share_toolbar:
Toast.makeText(getApplicationContext(), "shared lmao", Toast.LENGTH_SHORT).show();
return true;
}
return super.onOptionsItemSelected(item);
}
응답하지 않는 조각을 시작 ... 내 활동에 onOptionsItemSelected
을 무시하지만, 그것은 단지 특정 조각이 시작된 후, 난 정말 이해가 안가 작동 시작 툴바 작업 :
public void toSettings() {
Fragment_Settings frag = new Fragment_Settings();
fm.beginTransaction()
.replace(R.id.mainContainer, frag)
.addToBackStack(null)
.commit();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.arrow_left);
}
제발 도와주세요.