好記性不如爛筆頭,記錄一些常用的參數(shù)和效果
- 取消 listview 等列表滑動到邊緣閃現(xiàn)灰白色水波紋動畫

滑動到邊緣時會有水波效果
android:overScrollMode="never"
- 解決 recycleview 嵌套 NestedScrollView 滑動卡頓
mRecyclerView.setNestedScrollingEnabled(false);
或在 xml 中設置
android:nestedScrollingEnabled="false"
- ImageView 高度自適應
android:adjustViewBounds="true"

左邊的圖片未自適應時,上下會留白邊
- Button 取消陰影
style="?android:attr/borderlessButtonStyle"
點擊波紋效果
android:foreground="?android:attr/selectableItemBackground"

效果
波紋點擊效果可以加在任意 View 上
- visibility 隱藏和顯示時的動畫效果
在 ViewGroup 父布局加上
android:animateLayoutChanges="true"
View 的顯示隱藏會有一個簡單的動畫效果

- getColor 方法過時的寫法
ContextCompat.getColor(this, R.color.white)
- Toolbar 取消內寬
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
- TextView 行間距
//設置行間距
android:lineSpacingExtra="3dp"
//設置行間距的倍數(shù)
android:lineSpacingMultiplier="1.2