예제 #1
0
        private void resizeDialog()
        {
            WindowManagerLayoutParams _params = Window.Attributes;

            _params.Width     = (int)(DisplayUtil.getScreenSize(_context).X * 0.7);
            Window.Attributes = _params;
        }
예제 #2
0
        private void setBottomCorners(View llBtnGroup)
        {
            int radius = DisplayUtil.dp2px(Context, DEFAULT_RADIUS);

            float[]        outerRadii     = new float[] { 0, 0, 0, 0, radius, radius, radius, radius };
            RoundRectShape roundRectShape = new RoundRectShape(outerRadii, null, null);
            ShapeDrawable  shapeDrawable  = new ShapeDrawable(roundRectShape);

            shapeDrawable.Paint.Color = Color.White;
            shapeDrawable.Paint.SetStyle(Paint.Style.Fill);
            llBtnGroup.Background = shapeDrawable;
        }
예제 #3
0
        private void initView()
        {
            View contentView = View.Inflate(Context, Resource.Layout.layout_promptdialog, null);

            SetContentView(contentView);
            resizeDialog();

            mDialogView  = Window.DecorView.FindViewById(Android.Resource.Id.Content);
            mTitleTv     = (TextView)contentView.FindViewById(Resource.Id.tvTitle);
            mContentTv   = (TextView)contentView.FindViewById(Resource.Id.tvContent);
            mPositiveBtn = (TextView)contentView.FindViewById(Resource.Id.btnPositive);

            View      llBtnGroup = FindViewById(Resource.Id.llBtnGroup);
            ImageView logoIv     = (ImageView)contentView.FindViewById(Resource.Id.logoIv);

            logoIv.SetBackgroundResource(getLogoResId(mDialogType));

            LinearLayout topLayout  = (LinearLayout)contentView.FindViewById(Resource.Id.topLayout);
            ImageView    triangleIv = new ImageView(Context);

            triangleIv.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, DisplayUtil.dp2px(Context, 10));

            triangleIv.SetImageBitmap(createTriangel((int)(DisplayUtil.getScreenSize(_context).X * 0.7), DisplayUtil.dp2px(_context, 10)));

            topLayout.AddView(triangleIv);

            setBtnBackground(mPositiveBtn);
            setBottomCorners(llBtnGroup);


            int radius = DisplayUtil.dp2px(Context, DEFAULT_RADIUS);

            float[]        outerRadii     = new float[] { radius, radius, radius, radius, 0, 0, 0, 0 };
            RoundRectShape roundRectShape = new RoundRectShape(outerRadii, null, null);
            ShapeDrawable  shapeDrawable  = new ShapeDrawable(roundRectShape);

            shapeDrawable.Paint.SetStyle(Paint.Style.Fill);
            shapeDrawable.Paint.Color = Context.Resources.GetColor(getColorResId(mDialogType));
            LinearLayout llTop = (LinearLayout)FindViewById(Resource.Id.llTop);

            llTop.Background = shapeDrawable;

            mTitleTv.Text     = mTitle;
            mContentTv.Text   = mContent;
            mPositiveBtn.Text = mBtnText;
        }
예제 #4
0
        private void setBackgroundColor()
        {
            if (0 == mBackgroundColor)
            {
                return;
            }

            int radius = DisplayUtil.dp2px(Context, 6);

            float[]        outerRadii     = new float[] { radius, radius, radius, radius, 0, 0, 0, 0 };
            RoundRectShape roundRectShape = new RoundRectShape(outerRadii, null, null);
            ShapeDrawable  shapeDrawable  = new ShapeDrawable(roundRectShape);

            shapeDrawable.Paint.Color = mBackgroundColor;

            shapeDrawable.Paint.SetStyle(Paint.Style.Fill);
            mBkgView.Background = shapeDrawable;
        }