I am setting up the actionModeCloseDrawable icon as below
<item name="actionModeCloseDrawable">@drawable/ic_actionbar_back</item>
But I want to change it pro-grammatically on paticular event.
Is there any way to do so?
I have tried defining two styles and changing it on runtime, but that also didn't work.
Before
Code
new Handler(Looper.myLooper()).postDelayed(new Runnable() {
@Override
public void run() {
((AppCompatImageView)getActivity().findViewById(R.id.action_mode_close_button)).setImageDrawable(getContext().getResources().getDrawable(R.drawable.ic_person_white_24dp));
}
},5000);
After
Assumption & State:
ActionBar
is a part of Fragment hence getActivity().findViewById(int resId)
Handler
to simulate the delay of an event you are talking about.Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With