[MaterialCardView] stroke not rendering in preview
See original GitHub issueDescription: When applying stroke for the card it doesn’t show at all in the preview, but in the emulator and physical device it shows normally with no issues.
Expected behavior:
Preview
Physical device
Source code:
<com.google.android.material.card.MaterialCardView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="top|center_horizontal"
android:layout_margin="20dp"
app:cardCornerRadius="10dp"
app:cardElevation="10dp"
app:strokeColor="@color/red"
app:strokeWidth="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="10dp"
android:text="Stroke should be showing"
android:textColor="@color/textDark"
android:textSize="@dimen/text_mini" />
</com.google.android.material.card.MaterialCardView>
Android API version: tested on 29 and 30
Material Library version: 1.3.0-alpha03
Device: no problem with the device
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
strokeColor and strokeWidth not working in androidx.cardview ...
Just use the Material Components Library and the MaterialCardView which extends the androidx.cardview.widget.CardView . Something like:
Read more >MaterialCardView | Android Developers
Without a strokeColor , the card will not render a stroked border, regardless of the strokeWidth value. Cards implement Checkable , a default ......
Read more >Cards - Material Design
Note: Without an app:strokeColor, the card will not render a stroked border, regardless of the app:strokeWidth value. Checked icon attributes. Element ...
Read more >Hands-on with Material Components for Android: Cards
A MaterialCardView can be included in your layout like so: ... This defaults to 0dp (and will not be rendered if no strokeColor...
Read more >Set stroke, fill, drop shadow, and inner shadow for objects
As you modify the options in the color picker, you can preview the changes on the artboard. Note: Adobe XD also supports shorthand...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Perfect. Thanks for the quick response.
I’ve passed this along to the Android Studio team
@jgaillard85 Great. Thanks.