1
在Android M上使用23.3.0版本的支持庫和進行測試。在顯示Snackbar後出現FAB重新定位問題。Android浮動操作按鈕沒有重置位置
當顯示Snackbar時,晶圓廠正確向上移動,但當Snackbar解散時它不會向下移動。
代碼:
Snackbar.make(coordinatorLayout, R.string.msg_add_team, Snackbar.LENGTH_LONG).show();
也試過用小吃吧的回調功能給力的位置回到解僱,這打破了小吃吧隨後顯示,因爲它不再移動晶圓廠的出路。
代碼回調:
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
newGameFab.setTranslationY(0);
}
佈局:
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/upcoming_game_list"
/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/new_game"
android:layout_width="56dp"
android:layout_height="56dp"
android:src="@drawable/ic_add_white_24dp"
android:layout_gravity="bottom|end"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
android:layout_marginBottom="@dimen/fab_margin_bottom"
android:layout_marginRight="@dimen/fab_margin_right"
app:borderWidth="0dp"
app:backgroundTint="@color/accent"/>
提供的佈局是包含在具有CoordinatorLayout的不同佈局中的片段的一部分。 – Victus