If using @nativescript
:
tns plugin add nativescript-material-cardview
If using tns-core-modules
tns plugin add [email protected]
Be sure to run a new build after adding plugins to avoid any issues.
For Material Components to work correctly with {N} 6 and AndroidX you need to update your android app theme.
inside App_ressources/android/res/values/styles.xml
replace all occurences of Theme.AppCompat
with Theme.MaterialComponents
IMPORTANT: Make sure you include xmlns:mdc="nativescript-material-cardview"
on the Page element
<Page xmlns:mdc="nativescript-material-cardview">
<StackLayout horizontalAlignment="center">
<mdc:CardView width="100" height="100"/>
<mdc:CardView elevation="5" rippleColor="red" width="100" height="100"/>
</StackLayout>
</Page>
mdccardview {
ripple-color: blue;
elevation: 4;
}
import { NativeScriptMaterialCardViewModule } from "nativescript-material-cardview/angular";
@NgModule({
imports: [
NativeScriptMaterialCardViewModule,
...
],
...
})
<MDCardView rippleColor="blue" width="100" height="100"></MDCardView>
import Vue from 'nativescript-vue';
import CardViewPlugin from 'nativescript-material-cardview/vue';
Vue.use(CardViewPlugin);
<MDCardView rippleColor="blue" width="100" height="100"/>
Inherite from Nativescript StackLayout
- elevation optional
An attribute to set the elevation of the cardview. This will increase the 'drop-shadow' of the cardview.
- rippleColor optional
An attribute to set the ripple color of the cardview.