Tho*_*ohr 30 android android-appcompat android-button rippledrawable
我想在Buttons上使用涟漪效果.AppCompat v22.1为AppCompat着色添加了AppCompatButton和新功能.
我的布局:
<android.support.v7.widget.AppCompatButton
android:id="@+id/add_remove_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:backgroundTint="@color/primary"
android:textColor="@android:color/white"
android:text="Remove" />
Run Code Online (Sandbox Code Playgroud)
在我的API 22测试设备上,涟漪效应完美无缺,但我正在编写API 11,不幸的是backgroundTint需要API> = 21.如何在旧API版本上将涟漪效果设置为按钮?
dra*_*eet 85
只需使用app:backgroundTint代替android:backgroundTint,色彩将在棒棒糖下面生效.原因是AppCompatActivity AppCompatDelegateImplV7用于AppCompatViewInflater自动将Button或TextView更改为AppCompatButton或AppCompatTextView,然后app:backgroundTint生效.
| 归档时间: |
|
| 查看次数: |
22760 次 |
| 最近记录: |