java - How do you change the text color of the Toast that appears when an ActionBar Item is held? -
when user holds down actionbar item toast appears displaying item's title if 1 specified in android:title attribute in menu's layout file. in application, default background color same default text color rendering text illegible. how change background color or text color of these toasts?
i using android 5.1.

if change textcolor of toast, can reference this question, has example.
to on action bar item, you'll first need add custom view action bar since doesn't support way handle long clicks.
i create layout file used action bar, , inside activities oncreate() can this:
view actionbarview = getlayoutinflater().inflate(r.layout.my_action_bar, null) imageview actionitem = (imageview) actionbarview.findviewbyid(r.id.myimageviewicon); actionitem.setonlongclicklistener(new onlongclicklistener(){ @override public boolean onlongclick(view v){ // show toast custom text } }); actionitem.setonclicklistener(new onclicklistener(){ @override public boolean onclick(view v){ // handle regular click } }); getsupportactionbar().setcustomview(actionbarview); for more information on second part, can reference this question.
Comments
Post a Comment