code: private void inflateLayout() {
          imageButton = new ImageButton(getContext());
          LayoutParams layoutParams = new LayoutParams(0, 0);
          layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
          addView(imageButton, layoutParams);
      }
docs: Inflates the view's layout.