如何在cardview中添加圆形填充?

时间:2017-08-17 15:39:03

标签: android android-cardview

我想在我的cardview中添加圆形填充,但无法找到方法。 这是我的cardview代码,我想在cardViewOuter上添加圆形填充。

public void CreateCardViewWithImageView(Uri uri) {

    //CardView
    final CardView cardviewOuter;
    cardviewOuter = new CardView(context);

    cardviewOuter.setId(++pos);
    cardviewOuter.setLayoutParams((new CardView.LayoutParams(800, 800)));
    cardviewOuter.setContentPadding(25, 25, 25, 25);
    cardviewOuter.setRadius(height/2);
    cardviewOuter.setCardBackgroundColor(Color.MAGENTA);

    //Imageiew
    ImageView imageView = new ImageView(context);
    imageView.setId(pos);
    imageView.setOnTouchListener(new ImageMatrixTouchHandler(context));
    Picasso.with(imageView.getContext()).load(uri).resize(screenWidth,screenHeight).into(imageView);
    imageView.setLayoutParams(new CardView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    cardviewOuter.addView(imageView);
    frameLayout.addView(cardviewOuter);

}

0 个答案:

没有答案