ActionMode去掉返回箭头
来源:互联网 发布:大数据用什么语言最好 编辑:程序博客网 时间:2024/05/16 07:20
Android定制ActionMode模式,要去掉最左边返回箭头,源代码中没有提供接口,看了下源码,找到下面实现方法:
首先,设置Activity主题,修改如下:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="actionModeCloseButtonStyle">@style/ActionModeNoBack</item></style>
<style name="ActionModeNoBack" parent="Base.Widget.AppCompat.ActionButton.CloseMode"> <item name="android:visibility">gone</item></style>这个设置只能把左边按钮隐藏,并不能完全去掉原因请看ActionBarContextView.java onLayout onMeasure方法
接下来是自定义View的处理:
public class CustomTextView extends AppCompatTextView { public CustomTextView(Context context) { super(context); } public CustomTextView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public CustomTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int mode = MeasureSpec.getMode(widthMeasureSpec); int width = MeasureSpec.getSize(widthMeasureSpec); int customWidthMeasureSpec = widthMeasureSpec; if (getParent() instanceof ActionBarContextView) { View closeLayout = ((ActionBarContextView) getParent()).findViewById(R.id.action_mode_close_button); if (null != closeLayout) {customWidthMeasureSpec = MeasureSpec.makeMeasureSpec(closeLayout.getMeasuredWidth() + width, mode); } } super.onMeasure(customWidthMeasureSpec, heightMeasureSpec); }}
以上处理可以达到自定义ActionMode,而且不影响Menu处理。
阅读全文
0 0
- ActionMode去掉返回箭头
- 导航栏去掉系统返回按钮箭头后边的文字
- ActionMode
- ActionMode
- 去掉快捷箭头脚本
- 去掉快捷方式箭头
- 去掉快捷方式箭头
- numericUpDown去掉上下箭头
- 设置导航栏顶部返回箭头的颜色及去掉字
- 去掉Tree前面的箭头
- 去掉ExpandableListView的箭头图标
- 去掉ExpandableListView的箭头图标
- 去掉Win7快捷方式小箭头
- 去掉ExpandableListView左边的箭头
- 去掉ExpandableListView的箭头图标
- Win8去掉桌面图标的箭头
- Win7怎样去掉桌面图标箭头
- Win7怎样去掉桌面图标箭头
- 句柄再谈
- 初学易语言,所要准备些什么书籍与资料
- 基本数据类型
- 单调栈+STL——51nod1952 栈
- 图形学(5)多边形的扫描转换(下)
- ActionMode去掉返回箭头
- 数据结构_顺序表
- QDirModel
- PAT 1055. The World's Richest (25) 年龄排序问题(O(n)排序)
- LeetCode简易题解--629
- source insight常用的使用热键以及技巧
- Docker使用小结
- RT-Thread 01线程调度与管理
- I2C写设备端