Open dhruvilbadani opened 9 years ago
I just tried this
BigImageButtonsCard bibc = new BigImageButtonsCard(this);
bibc.setTitle("My Title");
bibc.setLeftButtonText("LEFT");
bibc.setRightButtonText("RIGHT");
bibc.setDrawable("http://1.bp.blogspot.com/-AuIFbAvqpGw/URaJXK6dyaI/AAAAAAAAAHg/nBxxESy1AuM/s1600/tux.png");
bibc.setDescription("My description");
bibc.setTitleColor(Color.parseColor("#FF0000"));
BasicButtonsCard bbc = new BasicButtonsCard(this);
bbc.setTitle("My other title");
bbc.setLeftButtonText("LEFT");
bbc.setRightButtonText("RIGHT");
bbc.setDrawable("http://1.bp.blogspot.com/-AuIFbAvqpGw/URaJXK6dyaI/AAAAAAAAAHg/nBxxESy1AuM/s1600/tux.png");
bbc.setDescription("My other description");
mListView.add(bibc);
mListView.add(bbc);
It worked as expected
http://i.imgur.com/2CvGgq4.jpg
Which MaterialList version and Android Version are you using?
Fixed, thank you. Another question though. I am using a Big Image with Buttons card. I'm using the setDrawable(String) method to set the image. How do I make this image fit the width of the card?
I'll take a look at it, as now I don't know if the code calls the fit methods from Picasso
It should be solved with v2.4.6 https://github.com/dexafree/MaterialList/commit/258232d7362d49545a5f686e912c73dd62f35020
Solved as in? I don't need to do anything more than setDrawable() with my URL?
Okay so I used 2.4.6. The images are centered but they yet do not fit the width of the card. Any help would be awesome
I think I will need to provide some "Image Behaviour" methods in order to satisfy all the needs (maybe some users prefer centered images even though the don'y fit the entire width).
I will try to take a look at it.
Try the new 2.5.0 https://github.com/dexafree/MaterialList/commit/c101bc01ccfb50a5cf26c2891fdad86213ba1987
You can now set the ScaleType directly to the Card
Thanks for that. I tried all the ScaleTypes but to no avail. Am I missing something here?
Can you provide an example card in order to try it?
String useURL = "http://assets.sbnation.com/assets/1035916/crazy-car-accident.jpeg"; BigImageButtonsCard card = new BigImageButtonsCard(getApplicationContext()); card.setDrawable(useURL); card.setImageScaleType(ImageView.ScaleType.CENTER); // Tried the scale types CENTER, CENTER_CROP, CENTER_INSIDE, FIT_CENTER, FIT_END, FIT_START, FIT_XY and MATRIX at this line card.setDescription(cardDescription); card.setDescriptionColor(Color.BLACK); card.setLeftButtonText(leftText); card.setLeffButtonTextColor(Color.BLACK); card.setRightButtonText(rightText); card.setRightButtonTextColor(Color.BLACK); mlv.add(card);
Sorry, I forgot to change one line at the XML that made this not work.
Now we're discussing about the new library version, which will bring a new nice Card building system, so I won't change the code base now, but if you don't mind downloading the library and importing it as a module, I can tell you which line you need to change in order for it to work.
(You only have to git clone the project, import the 'materialList' module to your project, and add the
compile project(':materialList')
line to your app build.gradle. You can see how it's done on the sample app).
The line is at the materialList/src/main/res/layout/material_image_with_buttons_card.xml
file, and you need to change at line 19, from android:layout_width="wrap_content"
to android:layout_width="fill_parent"
.
And it will work as expected.
It's a basic question but how do I import the 'materialList' module to my project? I have git cloned the project into my project's folder.
settings.gradle
filebuild.gradle
, addcompile project(':materialList')
Check the MaterialList sample app in order to se how the build.gradle files should be
Yes exactly, but I can't find the import module option in File in Android Studio. I went into the project Structure option and tried adding, but failed.
File -> New -> Import module
I am using BigImageButtonsCards and BasicButtonsCards in my MaterialListView. For some reason, the titles of the the BasicButtonsCards do not appear even though the text colour is black and the card background colour is white. However, when I use BasicButtonsCards only (no BigImageButtonsCards), the titles appear. Any idea why?