如何使用支持庫(kù)實(shí)現(xiàn)波紋動(dòng)畫?我想在按鈕點(diǎn)擊上添加一個(gè)漣漪動(dòng)畫。我確實(shí)喜歡下面但它需要minSdKVersion到21。ripple.xml<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item>
<shape android:shape="rectangle">
<solid android:color="?android:colorAccent" />
</shape>
</item></ripple>按鍵<com.devspark.robototextview.widget.RobotoButton
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple"
android:text="@string/login_button" />我想讓它向后兼容設(shè)計(jì)庫(kù)。怎么做到這一點(diǎn)?
3 回答

GCT1015
TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超4個(gè)贊
基本紋波設(shè)置
視圖中包含的漣漪。
android:background="?selectableItemBackground"
超出視圖范圍的漣漪:
android:background="?selectableItemBackgroundBorderless"
看看這里解決
?(attr)
Java代碼中的xml引用。
支持庫(kù)
使用
?attr:
(或?
簡(jiǎn)寫)代替?android:attr
引用支持庫(kù),因此可以返回到API 7。
漣漪與圖像/背景
要獲得圖像或背景并覆蓋紋波,最簡(jiǎn)單的解決方案是使用或
View
將FrameLayout
包含在波紋組中。setForeground()
setBackground()
老實(shí)說(shuō),除此之外沒有干凈的方式這樣做,盡管尼克布徹在漣漪的主題上發(fā)布了這個(gè)ImageView
- 3 回答
- 0 關(guān)注
- 432 瀏覽
添加回答
舉報(bào)
0/150
提交
取消