implementation 'com.google.android.material:material:1.0.0' 我在 Build.gradle 中添加了以下依賴項(xiàng)<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"
/>常規(guī)按鈕已形成,但應(yīng)該有一個(gè)輪廓按鈕,因?yàn)槲沂褂昧诉@種樣式: style=@style/Widget.MaterialComponents.Button.OutlinedButton所選的最低 Api 是否有任何問(wèn)題或任何其他問(wèn)題,請(qǐng)幫助我解決這個(gè)問(wèn)題,謝謝
1 回答

Smart貓小萌
TA貢獻(xiàn)1911條經(jīng)驗(yàn) 獲得超7個(gè)贊
在基礎(chǔ)應(yīng)用程序主題中使用 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>
添加回答
舉報(bào)
0/150
提交
取消