android.support.v7.widget.PopupMenu.setGravity()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(1.0k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中android.support.v7.widget.PopupMenu.setGravity()方法的一些代码示例,展示了PopupMenu.setGravity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PopupMenu.setGravity()方法的具体详情如下:
包路径:android.support.v7.widget.PopupMenu
类名称:PopupMenu
方法名:setGravity

PopupMenu.setGravity介绍

暂无

代码示例

代码示例来源:origin: mancj/MaterialSearchBar

private void inflateMenuRequest(int menuResource, int iconResId
) {
  int menuResource1 = menuResource;
  if (menuResource1 > 0) {
    ImageView menuIcon = findViewById(R.id.mt_menu);
    if (iconResId != -1) {
      menuIconRes = iconResId;
      menuIcon.setImageResource(menuIconRes);
    }
    RelativeLayout.LayoutParams params = (LayoutParams) searchIcon.getLayoutParams();
    params.rightMargin = (int) (48 * destiny);
    searchIcon.setLayoutParams(params);
    menuIcon.setVisibility(VISIBLE);
    menuIcon.setOnClickListener(this);
    popupMenu = new PopupMenu(getContext(), menuIcon);
    popupMenu.inflate(menuResource);
    popupMenu.setGravity(Gravity.RIGHT);
  }
}

代码示例来源:origin: w568w/fuckView

popupMenu.setGravity(Gravity.CENTER);
view.setBackgroundColor(Color.argb(120, 255, 0, 0));
updateLayout();

相关文章