implementation 'com.google.android.material:material:1.0.0' 我在 Build.gradle 中添加了以下依賴項<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
android:layout_marginTop="88dp"
android:background="@drawable/ic_launcher_background"
android:text="Click Me"
android:textColor="@color/colorAccent"
android:textSize="15sp"
app:backgroundTint="#00FFFFFF"
app:iconTint="@color/colorAccent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeColor="@color/colorAccent"
/>常規按鈕已形成,但應該有一個輪廓按鈕,因為我使用了這種樣式: style=@style/Widget.MaterialComponents.Button.OutlinedButton所選的最低 Api 是否有任何問題或任何其他問題,請幫助我解決這個問題,謝謝
1 回答

Smart貓小萌
TA貢獻1911條經驗 獲得超7個贊
在基礎應用程序主題中使用 Material 組件主題作為父主題。像下面這樣
<!-- Base application theme. --> <style name="AppTheme" parent="**Theme.MaterialComponents.Light.NoActionBar**"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style>
添加回答
舉報
0/150
提交
取消