Уродливый результат:
Мой макет:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.button.MaterialButton
android:id="@+id/material_text_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contact"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="59dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/material_button"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Default"
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="114dp"
android:layout_marginTop="109dp" app:layout_constraintTop_toBottomOf="@+id/material_text_button"/>
</android.support.constraint.ConstraintLayout>
Цвет:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorOnPrimary">#FFFFFF</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="colorOnSurface">#000000</color>
<color name="colorOnSurfaceSecondary">#d3d3d3</color>
<color name="colorOnBackground">#000000</color>
</resources>
Gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.material:material:1.0.0-beta01'
}
Что я здесь не так делаю? Это действительно так ужасно по умолчанию? Это на API 21.
Ссылка на материал: https://material.io/develop/android/components/material-button/