我正在尝试在屏幕内部布局中使用带有圆角的新 Material Components 实现 MaterialButton
<android.support.design.button.MaterialButton
android:text="@string/login"
android:id="@+id/btnEntrance"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="104dp"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_height="40dp"
app:cornerRadius="8dp"/>
但是在预览屏幕上圆角是不可见的——这个属性不会对 View 产生任何影响。谁能解释一下为什么?
最佳答案
android:theme="@style/Theme.MaterialComponents"
将这条线添加到您的 Material 按钮。
关于android - 属性 app :cornerRadius doen't work for the MaterialButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53270601/