title: Resize custom menu item
body: <p>I need help to re-size my current menu item. I created a custom menu with programmatically  added items in a <code>TableLayout</code>. This is my current menu:</p>
  
  <p><img src="https://i.stack.imgur.com/ZNVns.png" alt="this is my current menu"></p>
  
  <p>I need to change the height of the first menu. Now the problem is that when I change the height of the first menu item the entire menu changes its height. I want menu like this:</p>
  
  <p><img src="https://i.stack.imgur.com/UYKuA.png" alt="i want menu like this"> </p>
  
  <p>Is there any way to re-size my current item?</p>
  
  <pre><code>public synchronized void show(View v) {
      mIsShowing = true;
      boolean isLandscape = false;
      int itemCount = mMenuItems.size();
      if (itemCount&lt;1) return; //no menu items to show
      if (mPopupWindow != null) return; //already showing
      Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
      if (display.getWidth() &gt; display.getHeight()) isLandscape = true;
      View mView= mLayoutInflater.inflate(R.layout.custom_menu, null);
      mPopupWindow = new PopupWindow(mView,LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT, false);
      mPopupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
      mPopupWindow.setWidth(display.getWidth());
      mPopupWindow.showAtLocation(v, Gravity.BOTTOM, 0, 0);
  
      int divisor = mItemsPerLineInPortraitOrientation;
      if (isLandscape) divisor = mItemsPerLineInLandscapeOrientation;
      int remainder = 0;
      if (itemCount &lt; divisor) {
          mRows = 1;
          remainder = itemCount;
      } else {
          mRows = (itemCount / divisor);
          remainder = itemCount % divisor;
          if (remainder != 0) mRows++;
      }
      TableLayout table = (TableLayout)mView.findViewById(R.id.custom_menu_table);
      table.removeAllViews();
  
      for (int i=0; i &lt; mRows; i++) {
          TableRow row = null;
          TextView tv = null;
          ImageView iv = null;
  
          row = new TableRow(mContext);
          row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
          for (int j=0; j&lt; divisor; j++) {
              if (i*divisor+j &gt;= itemCount) break;
              final CustomMenuItem cmi = mMenuItems.get(i*divisor+j);
              View itemLayout = mLayoutInflater.inflate(R.layout.custom_menu_item, null);
              if  (j==0)
              {
                  itemLayout.setBackgroundResource(R.drawable.current_menu);
                  itemLayout.setPadding(5, 5, 5, 5);
              }
  
              tv = (TextView)itemLayout.findViewById(R.id.custom_menu_item_caption);
              tv.setText(cmi.getCaption());
              iv = (ImageView)itemLayout.findViewById(R.id.custom_menu_item_icon);
              iv.setImageResource(cmi.getImageResourceId());
              itemLayout.setOnClickListener( new OnClickListener() {
                 @Override
                 public void onClick(View v) {
                      mListener.MenuItemSelectedEvent(cmi);
                      if (mHideOnSelect) hide();
                 }
              });
              row.addView(itemLayout);
          }
          table.addView(row);
      }
  }
  </code></pre>
  
  <p>if i give background to entire row than result
  <img src="https://i.stack.imgur.com/RuHI6.png" alt="">
  if give background to layout(each menu item) by this line  itemLayout.setBackgroundResource(R.drawable.menubackground);
  <img src="https://i.stack.imgur.com/2A8Qg.png" alt="enter image description here"></p>
  
  <p>But i want look like this menu
  <img src="https://i.stack.imgur.com/yt8Vi.png" alt="enter image description here"></p>