我在API <= 19上遇到了FAB shadow的问题。我使用了compatElevation= 0f,shadow消失了。但它在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中设置大小时,一切正常
发布于 2019-01-18 11:29:56
使用此代码
android:elevation="0dp"
app:elevation="0dp"
发布于 2019-01-18 11:31:19
通过添加以下内容来覆盖FAB的默认高程
android:elevation="0dp"
发布于 2019-01-18 11:42:28
Java
setStateListAnimator(null);
XML
android:stateListAnimator="@null"
https://stackoverflow.com/questions/54253010
复制相似问题