0
我想從動畫製作fab按鈕從片段到android中的活動。下面的代碼從活動到另一個活動,但不是從android中的片段到活動。如何讓它工作?無法動畫從片段到Android中的活動
public class ListFragment extends Fragment {
FloatingActionButton fab;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
R.layout.fragment, container, false);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getActivity(), MainActivity.class);
i.putExtra("title", "title");
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), fab, "image");
ActivityCompat.startActivity(getActivity(), i, options.toBundle());
} }); }