LoginSignup
1
1

More than 5 years have passed since last update.

ActionBarとTabBarの上下が入れ替わってしまう

Last updated at Posted at 2014-11-12

現象

ActionBarにカスタムビューを指定した際、AndroidのバージョンによってはTabBarと上下が入れ替わってしまうことがあった。

対策

actionBar.setDisplayOptionsの引数にActionBar.DISPLAY_SHOW_HOMEフラグを追加すると正常に動作する。

副作用

上記の対策だとアイコン画像が必ず表示されてしまう。
もし消したければ、

View homeIcon = findViewById(android.R.id.home);
((View) homeIcon.getParent()).setVisibility(View.GONE);

のようにする。

参考

Tabs Coming above Action bar when inflating custom layout
ActionBarSherlock - Tabs appearing ABOVE actionbar with custom view

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1