This library let you use views with neumorphism design so simple like below
and supports Button,TextView,CardView.
Dark mode | Light mode |
---|---|
![]() |
![]() |
Step 1. Add it in your root build.gradle(project level) at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency in build.Gradle(module-level)
dependencies {
implementation 'com.github.Amirhossein79e:Neumorphism:1.4'
}
After you added the library to your project follow the below steps
Usage of the views is so simple because there are extended from AndroidX AppCompatViews and just 5 attributes you need to specify for using the views.
This library have 3 views currently:
1.NeuCardView
same as CardView
2.NeuTextView
same as AppCompatTextView
3.NeuButton
same as AppCompatButton
The attributes you should specify, if you don't use them then the view use the default value defined in the library :
-
app:neu_background_color="solid color"
:
This attr set the solid background color for the view. currently not support gradient. -
app:neu_light_shadow_color="solid color"
:
This attr set the color for the light shadow color in the direction of the light source. in Neumorphism design you need dark shadow and light shadow. -
app:neu_dark_shadow_color="solid color"
:
This attr set a color for the dark shadow color of view. -
app:neu_elevation="dimension"
:
This attr set elevation for the view and acts like the CardViewcard_elevation
attr. whatever it be larger shadows around the view will be larger. -
app:neu_radius="dimension"
:
This attr set the corner radius for the view and acts like the CardViewcard_corner_radius
attr. whatever it be larger bounds of the view will be more rounded.
below we have an example usage of the NeuCardView
in ConstraintLayout.
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@color/md_blue_grey_800">
<com.amirhosseinemadi.neumorphism.widget.NeuCardView
android:layout_width="164dp"
android:layout_height="164dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:neu_background_color="@color/md_blue_grey_800"
app:neu_light_shadow_color="@color/md_blue_grey_700"
app:neu_dark_shadow_color="@color/md_blue_grey_900"
app:neu_elevation="6dp"
app:neu_radius="12dp">
</com.amirhosseinemadi.neumorphism.widget.NeuCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
I Hope this library helps you