android - 阴影问题 Floating Action Button (api = 19)
问题描述
我在 API <= 19 上遇到了 FAB 阴影问题。我使用了 compatElevation= 0f 并且阴影消失了。但它在 onClick 期间再次出现并且看起来很奇怪:
XML 代码:
<android.support.design.widget.FloatingActionButton
android:id="@+id/RateBtn"
android:layout_width="@dimen/backet_Btn_size"
android:layout_height="@dimen/backet_Btn_size"
android:elevation="0dp"
app:elevation="0dp"
android:clickable="true"
android:focusable="true"
android:src="@drawable/star_rate2"
app:backgroundTint="@color/w"
app:layout_constraintEnd_toEndOf="@+id/langBtn2"
app:layout_constraintStart_toStartOf="@+id/langBtn2"
app:layout_constraintTop_toTopOf="@+id/SettingsBtn"
app:rippleColor="@color/grey_700" />
代码:
var fb = view?.findViewById(R.id.RateBtn) as FloatingActionButton
val lp =it.layoutParams
if (lp !=null){
lp.width= size_fb
lp.height=size_fb
it.customSize=size_fb
it.layoutParams= lp
}
我认为当我尝试以编程方式更改 FAB 大小时存在一些问题。当我在 xml 中设置大小时,一切正常
解决方案
爪哇
setStateListAnimator(null);
XML
android:stateListAnimator="@null"
推荐阅读
- html - 防止或反转 CSS 旋转应用于子元素
- python - 在多对多 django 应用程序中显示的所有记录
- r - 在 R studio 中将重复的行重新整形/转置为列
- python - VS Code 看不到 sqlite3
- r - 将向量与大型 data.table 合并以执行计算的内存有效方法 (R)
- javascript - Mongoose 写入的网络性能问题
- stm32f7 - STM32F767ZI 核板没有连接USB
- c# - transform.position 不移动玩家
- c++ - Homebrew 在哪里安装 C++ 包?
- angular - 错误 TS2345:类型为“字符串”的参数 | null' 不能分配给“数字”类型的参数