私は ActionBarSherlock を使用しており、Google マップで知られているホーム ボタンと同様の機能が必要です。
このコードでホームボタンを押すと、すでにQuickAction(http://code.google.com/p/simple-quickactions/ )を開くことができました:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
View anchor = findViewById(R.id.text); // how do I get the home button view here?
quickAction.show(anchor);
return true;
}
return false;
}
ただし、アクティビティの単純な TextView をアンカー (R.id.text) として使用しています。そこでActionBarからホームボタンビューを取得するにはどうすればよいですか?
ああ、findViewById(android.R.id.home)
またはfindViewById(item.getItemId())
両方とも null を返します。