내 앱은 프래그먼트에서 액티비티로 공유 요소를 전환하는 데 사용됩니다. 정확히 작동이 멈췄을 때 나는 확실하지 않습니다. 사소한 코드 변경을했지만 변경 사항 주변의 코드에는 영향을주지 않습니다. 내가 한 가장 큰 일은 지원 라이브러리를 v24.2.1 (v23.3.0부터)로 업데이트하는 것입니다. 어리석은 뭔가를 간과하고 있거나 지원 라이브러리가 변경된 것이 있는지 궁금합니다. 관련 코드 조각은 다음과 같습니다왜 공유 요소 전환이 작동하지 않습니까?
공유 요소 전환 시작하는 코드 : (위의 코드에서 _selectedPreview)
public void PreviewClicked(object sender, EventArgs e)
{
var intent = new Intent(Activity, typeof(RoutineActivity));
intent.PutExtra(RoutineBundleKeys.BLOB_ID, _selectedBlobId.ToString());
intent.PutExtra(RoutineBundleKeys.ROUTINE_TITLE, _selectedTitle);
intent.PutExtra(RoutineBundleKeys.ROUTINE_HTML, ViewModel.Html);
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
_selectedPreview.TransitionGroup = true;
ActivityOptionsCompat options = ActivityOptionsCompat.MakeSceneTransitionAnimation(Activity,
_selectedPreview,
"webview_preview_transition");
StartActivity(intent, options.ToBundle());
}
else
{
StartActivity(intent);
}
}
그리고 공유되고있는 XML 요소를 :
<WebView
android:id="@+id/routine_preview"
android:layout_width="match_parent"
android:layout_height="100dp"
android:gravity="center_vertical"
android:scrollbars="none"
android:transitionName="webview_preview_transition" />
에서 OnCreate 완료시 작업 방법 :
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.routine_activity_layout);
_routineTitle = Intent.GetStringExtra(RoutineBundleKeys.ROUTINE_TITLE);
var titleToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.doc_title_toolbar);
SetSupportActionBar(titleToolbar);
SupportActionBar.Title = _routineTitle;
_htmlString = Intent.GetStringExtra(RoutineBundleKeys.ROUTINE_HTML);
if (_htmlString != null)
{
_routineView = FindViewById<WebView>(Resource.Id.routine_frame);
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
_routineView.TransitionGroup = true;
}
_routineView.Settings.BuiltInZoomControls = true;
_routineView.Settings.DisplayZoomControls = false;
string mimeType = "text/html";
string encoding = "UTF-8";
_routineView.LoadDataWithBaseURL("", _htmlString, mimeType, encoding, "");
}
else
{
var blobIdString = Intent.GetStringExtra(RoutineBundleKeys.BLOB_ID);
_blobId = new Guid(blobIdString);
RoutineFragment routineFragment = new RoutineFragment(_blobId);
SupportFragmentManager.BeginTransaction().Replace(Resource.Id.routine_frame, routineFragment).Commit();
}
}
그리고이 Activi의 XML 타이 :
내 기본 테마에서<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nothing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/doc_title_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<WebView
android:id="@+id/routine_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transitionName="webview_preview_transition" />
</LinearLayout>
, 나는 <item name="android:windowContentTransitions">true</item>
나는 문제가있을 수 있습니다 무엇 딱하다 않아도됩니다. 모든 것이 올바르게 설정되어있는 것처럼 보입니다.