Vir*_*hit 6 android android-actionmode
我正在设置actionModeCloseDrawable图标,如下所示
<item name="actionModeCloseDrawable">@drawable/ic_actionbar_back</item>
Run Code Online (Sandbox Code Playgroud)
但我想在特定事件上以编程方式改变它.
有没有办法这样做?
我已经尝试定义两个样式并在运行时更改它,但这也没有用.
代码
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);
Run Code Online (Sandbox Code Playgroud)
假设与状态:
ActionBar是 Fragment 的一部分,因此getActivity().findViewById(int resId) Handler模拟过你所说的事件的延迟。希望这可以帮助。
| 归档时间: |
|
| 查看次数: |
388 次 |
| 最近记录: |