How to add ActionBarActivity in Android Project? -
i'm not able add actionbaractivity in android project. there no options of appcpmpat-v7
in of project.
what now?
public class mainactivity extends activity {
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); actionbar mactionbar = getactionbar(); mactionbar.setdisplayshowhomeenabled(false); mactionbar.setdisplayshowtitleenabled(false); layoutinflater minflater = layoutinflater.from(this); view mcustomview = minflater.inflate(r.layout.custom_actionbar, null); textview mtitletextview = (textview) mcustomview.findviewbyid(r.id.title_text); mtitletextview.settext("my own title"); imagebutton imagebutton = (imagebutton) mcustomview .findviewbyid(r.id.imagebutton); imagebutton.setonclicklistener(new onclicklistener() { @override public void oncl`enter code here`ick(view view) { toast.maketext(getapplication`enter code here`context(), "refresh clicked!", toast.length_long).show(); } }); mactionbar.setcustomview(mcustomview); mactionbar.setdisplayshowcustomenabled(true); }
}
Comments
Post a Comment