Android : Hiding action bar in fragment -
i have 2 fragments mainfragment
, childfragment
. want show actionbar in mainfragment
wants hide in childfragment
. working fine except when comes mainfragment
childfragment
, again goes childfragment
action bar shows seconds before hidden ..
i don't know why ? help
in childfragment
doing this
@override public void onresume() { super.onresume(); ((actionbaractivity) getactivity()).getsupportactionbar().hide(); mainactivity.mdrawerlayout.setdrawerlockmode(drawerlayout.lock_mode_locked_closed); getview().setfocusableintouchmode(true); getview().requestfocus(); getview().setonkeylistener(new view.onkeylistener() { @override public boolean onkey(view v, int keycode, keyevent event) { if (event.getaction() == keyevent.action_up && keycode == keyevent.keycode_back) { // handle button's click listener mainactivity.onbackpressed(); ((actionbaractivity) getactivity()).getsupportactionbar().show(); mainactivity.mdrawerlayout.setdrawerlockmode(drawerlayout.lock_mode_unlocked); return true; } return false; } }); }
you should handle transitions in main activity... there should handle logic according needs - such hiding/showing action bar , such...
Comments
Post a Comment