I know that there are some design layouts (for example TEXT, TITLE, COLUMS etc.) What I would like to show is just a picture from drawable. When I use the TEXT Layout with .addImage, the picture is in background (darker). I tried to use the TITLE Layout, but in this case I also see a black vignette at the bottom.
I would like to screen only a picture. And I'm using the devicedefault theme, because I've also some cards with only text or columns etc.
I tried to use an EMBEDDED Layout with a custom XML file, but the picture is not fullscreen. Is there a simple solution for this problem? Thank you in advance. Here is also the code, im still having trouble:
private void addImageView(LinearLayout layout) {
ImageView iv = new ImageView(this);
Object drawable;
iv.Drawable(Drawable drawable); //problem here?
iv.setPadding(0, 0, 0, 0);
iv.setAdjustViewBounds(true);
iv.setScaleType(ImageView.ScaleType.CENTER);
}
private void createCards() {
mCards = new ArrayList<CardBuilder>();
mCards.add(new CardBuilder(this, CardBuilder.Layout.TITLE)
.setText("This is TITLE")
.addImage(R.drawable.title)
.setImageLayout( ImageLayout.FULL)); //also problem here?
You can simply set an ImageView
as the content of the Activity
:
ImageView image = new ImageView(this);
image.setScaleType(ImageView.ScaleType.CENTER_CROP);
image.setImageDrawable(yourDrawable);
// or image.setImageResource(R.drawable.your_image);
// or image.setImageBitmap(yourBitmap);
setContentView(image, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));