0
AppCompact v7의 Support Action Bar를 사용하기 만합니다. 나는 (사실) bar.setDisplayHomeAsUpEnabled를 작성하고이 버튼을 듣고 싶은,하지만 리스너에서 해요 :Listener Home 및 HomeAsUp 버튼이 지원 작업 표시 줄에서 작동하지 않습니다.
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch (id) {
case R.id.action_settings:
return true;
case R.id.HomeAsUp:
return true;
default:
break;
}
return super.onOptionsItemSelected(item);
}
내가 아이디, 메소드의 반환 아무것도에서 항목을 찾으려합니다. Support Action Bar로이 버튼을 듣는 방법?
R.id.HomeAsUp 대신, android.id.R.home을 시도하십시오. – michaelcarrano
감사합니다. 이 기능은 작동하지만 HomeAsUp 버튼은 어떻게됩니까? – user3418460
나는 집을 보지 못했습니다. 유효한 안드로이드라고. R.id ...이게 당신이 직접 만든 이드입니까? – michaelcarrano