儘量讓你的谷歌地圖的快照:
private void snapShot() {
SnapshotReadyCallback callback = new SnapshotReadyCallback() {
Bitmap bitmap;
@Override
public void onSnapshotReady(Bitmap snapshot) {
// TODO Auto-generated method stub
bitmap = snapshot;
try {
FileOutputStream out = new FileOutputStream(getActivity()
.getFilesDir() + "/MapSnapshot.png");
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (Exception e) {
e.printStackTrace();
}
}
};
map.snapshot(callback);
}
的使它們只有在地圖的圖片中的新片段。使用replace加載這個新片段,然後在要替換的片段上進行轉換: final SnapShotFragment snapFrag = new SnapShotFragment(); FragmentTransaction transaction = getFragmentManager() .beginTransaction();
transaction.replace(MapFragment.this.getId(),
snapFrag);
transaction.addToBackStack(null);
transaction.commit();
getFragmentManager().executePendingTransactions();
final boolean roi = isInROI;
WayPointDetailActivity waypointFrag = new WayPointDetailActivity();
waypointFrag.setWayPointId(wp.getId());
waypointFrag.setInRoi(roi);
transaction = getFragmentManager()
.beginTransaction();
transaction.setCustomAnimations(R.anim.enter,
R.anim.exit);
transaction.replace(snapFrag.getId(), waypointFrag);
transaction.addToBackStack(null);
transaction.commit();
我相信我有它在Galaxy S2上工作,但不是其他人。明天早上我上班時,我會回來向您介紹這方面的情況。 – RobGThai
檢查這個問題了。接受的答案幫助了我。 http://stackoverflow.com/questions/7718111/android-fragment-standard-transition-not-animating – Sababado