Sumber : https://blog.sekolahmobile.com/membuat-aplikasi-kalkulator-di-android-dengan-kotlin/
1. Tambahkan pada gradle
implementation 'net.objecthunter:exp4j:0.4.8'
2. Buat file dimens.xml di values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="text_result_calculator">56sp</dimen>
<dimen name="activity_padding">24dp</dimen>
<dimen name="button_calculator">78dp</dimen>
<dimen name="button_margin">16dp</dimen>
<dimen name="radius_button">16dp</dimen>
<dimen name="textSize_button">24sp</dimen>
</resources>
3. Menambah warna pada colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="colorRipple">#ACACAC</color>
<color name="colorGray">#DEDEDE</color>
<color name="colorYellow">#f2ae27</color>
<color name="colorGreen">#21c353</color>
</resources>
3. Buat 3 ripple
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:andrid="http://schemas.android.com/aapt"
xmlns:tools="http://schemas.android.com/tools"
android:color="@color/colorRipple"
tools:ignore="NewsApi">>
<item>
<shape android:shape="rectangle">
<solid andrid:color="@color/colorGreen"/>
<corners android:radius="16dp"/>
</shape>
</item>
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/colorRipple"/>
<corners android:radius="16dp"/>
</shape>
</item>
</ripple>
Comments
Post a Comment