1

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?

2 Answers2

1

Please look at this link and I am sure it will help you a lot, I was also using it on Google Glass Card Design.

DaChavoh
  • 100
  • 1
  • 16
  • Thank you very much for the link! I have read the most of it but I still can't figure fix the issue on google glass. I'd like just to get rid off the gradient. And I know that there is no Card without this annoying gradient yet. I just extended my question with the code. May you go through it quickly? – Faruk Doganci Apr 16 '15 at 14:05
0

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));
Simon Marquis
  • 7,248
  • 1
  • 28
  • 43