Code example for ColorDrawable

0
        if (contentView == null) {
            throw new IllegalStateException("You need to set the content view using the setContentView method");
        } 
 
        // Replaces the background of the popup with a cleared background 
        setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
 
        final int[] loc = mLocation;
        anchor.getLocationOnScreen(loc);
        mRect.set(loc[0], loc[1], loc[0] + anchor.getWidth(), loc[1] + anchor.getHeight());
 
        if (mIsDirty) {
            clearQuickActions(); 
            populateQuickActions(mQuickActions);
        } 
 
        onMeasureAndLayout(mRect, contentView);
 
        if ((mPrivateFlags & MEASURE_AND_LAYOUT_DONE) != MEASURE_AND_LAYOUT_DONE) {
            throw new IllegalStateException("onMeasureAndLayout() did not set the widget specification by calling"