根據浮動動作按鈕的新Android Design Guidelines,它應該是合理的transform the Floating Action Button into a Toolbar。浮動動作按鈕擴展
是否有任何示例/示例來執行此類轉換?
根據浮動動作按鈕的新Android Design Guidelines,它應該是合理的transform the Floating Action Button into a Toolbar。浮動動作按鈕擴展
是否有任何示例/示例來執行此類轉換?
要使用顯示的動畫,你需要一個onLayoutChange監聽器添加到像這樣的onCreateView回調的觀點:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Inflate the layout for this fragment
final View view = inflater.inflate(R.layout.fragment_map_list, container, false);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
v.removeOnLayoutChangeListener(this);
revealView(view);
}
});
}
return view;
}
其中revealView()方法將是:
private void revealView(View view) {
toolbar = view.findViewById(R.id.mytoolbar);
int cx = (view.getLeft() + view.getRight())/2;
int cy = (view.getTop() + view.getBottom())/2;
float radius = Math.max(infoContainer.getWidth(), infoContainer.getHeight()) * 2.0f;
if (infoContainer.getVisibility() == View.INVISIBLE) {
infoContainer.setVisibility(View.VISIBLE);
ViewAnimationUtils.createCircularReveal(infoContainer, cx, cy, 0, radius).start();
} else {
Animator reveal = ViewAnimationUtils.createCircularReveal(
infoContainer, cx, cy, radius, 0);
reveal.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
toolbar.setVisibility(View.INVISIBLE);
}
});
reveal.start();
}
}
這樣你應該可以創建你的動畫。這是使用它的方式。只需在您的晶圓廠應用此onClick()方法
您可以使用揭示動畫。點擊晶圓廠,你可以開始動畫顯示你想要的工具欄。當然,晶圓廠將只有這個功能。 –
試着看我的回答 –