1、Android菜单目录的横向排列方法
看下这个博客https://blog.csdn.net/cgwcgw_/article/details/9773989
首先我也是想到这样的方法,简单方便,岂不妙哉。
这个方法的案例都是2013年之前的 近年来看不到了 我试了 失效啊他娘的
几乎不用menu
2、Tap Bar Menu
开源地址https://github.com/michaldrabik/TapBarMenu
我用了 挺好的 但是好不好修改我不知道 且我在老项目使用起来并不友好 或者说无法饮用 最低支持api 16 想到要修改菜单按钮的位置还有显示的位置能不能下移 感觉很麻烦 算了 放弃了
3、最后我使用了Android仿QQ长按删除弹出框的方法
名字 叫做 popupwindow
附下框架链接吧:但是我并没用也没具体看 因为我的需求比较简单
https://github.com/wanglu1209/WPopup
以下附上本人的使用的代码:`private void showMore(View moreBtnView) {
if (mMorePopupWindow == null) {
LayoutInflater li = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View content = li.inflate(R.layout.shishi, null, false);
mMorePopupWindow = new PopupWindow(content, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
mMorePopupWindow.setBackgroundDrawable(new BitmapDrawable());
mMorePopupWindow.setOutsideTouchable(true);
mMorePopupWindow.setTouchable(true);
content.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
mShowMorePopupWindowWidth = content.getMeasuredWidth();
mShowMorePopupWindowHeight = content.getMeasuredHeight();
View parent = mMorePopupWindow.getContentView();
/* TextView like = (TextView) parent.findViewById(R.id.like);
TextView comment = (TextView) parent.findViewById(R.id.comment);*/
// 点赞的监听器
/*comment.setOnClickListener(this);*/
}
if (mMorePopupWindow.isShowing()) {
mMorePopupWindow.dismiss();
} else {
int heightMoreBtnView = moreBtnView.getHeight();
mMorePopupWindow.showAsDropDown(moreBtnView, -mShowMorePopupWindowWidth,
-(mShowMorePopupWindowHeight + heightMoreBtnView) / 2);
}
}`
这段话需要注意是MATCH_PARENT或者WRAP_CONTENT
mMorePopupWindow = new PopupWindow(content, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);