java - Custom Action bar w/ done and cancel buttons -



java - Custom Action bar w/ done and cancel buttons -

i'm trying follow answers of question: cancel done buttons in calendar app - part of action bar? want create custom action bar

i'm noob on android, questions are: have code fragment? how can this? created method set custom bar, i'm calling @ oncreateview, it's not working...the action bar doesn't appears.

private void createcustomactionbar(){ inflater = (layoutinflater) getsystemservice(context.layout_inflater_service); view actionbarbuttons = inflater.inflate(r.layout.custom_action_bar, new linearlayout(myactivity.this), false); view cancelactionview = actionbarbuttons.findviewbyid(r.id.action_cancel); cancelactionview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { seek { processform(); } grab (exception e) { e.printstacktrace(); } } }); view doneactionview = actionbarbuttons.findviewbyid(r.id.action_done); // doneactionview.setonclicklistener(); this.getactionbar().setcustomview(actionbarbuttons); }

i copied xml's, color, drawables github's project.

looks you're missing single line of code before set custom actionbar:

this.getactionbar().setdisplayshowcustomenabled(true);

see documentation.

set whether custom view should displayed, if set.

java android

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -