मेरे पास वैश्विक एप्लिकेशन में फ़ीड डेटा की सूची है। मैं MainAcitivty
अंतिम गतिविधि में कस्टम साझा तत्व संक्रमण
// selected item event
Intent intent = new Intent(this, DetailActivity.class);
intent.putExtra("item_feed_index", selectedItemIndex);
FeedViewHolder viewHolder = getViewHolderFromPosition(position);
Pair<View, String> pair1 = Pair.create(viewHolder.imageView, "TransitionName.Feed.Image");
Pair<View, String> pair2 = Pair.create(viewHolder.textView, "TransitionName.Feed.Text");
Pair<View, String> pair3 = Pair.create(viewHolder.button, "TransitionName.Feed.Button");
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, pair1, pair2, pair3);
startActivity(intent, options.toBundle());
में मेरी RecyclerView
से एक संक्रमण बनाने के लिए इस कोड का इस्तेमाल किया यह काम करता है। लेकिन समस्या यह है कि DetailActivity
में, मेरे पास एक और लंबवत सूची है, जो उपयोगकर्ता फ़ीड आइटम को सूची में बदलने के लिए नीचे/नीचे स्क्रॉल कर सकता है (जो स्क्रॉल इंडेक्स भी बदलता है)।
जब DetailActivity
से वापस दबाएं, तो मैं बाहर निकलने वाली एनीमेशन संक्रमण सही देखने वाली फ़ीड इंडेक्स पर निष्पादित करना चाहता हूं। मैं उसे कैसे कर सकता हूँ?
यह onActivityResult
MainActivity
में कोड है, यह स्थिति को सही करने के लिए रीसायकल स्क्रॉल करता है, लेकिन निकास संक्रमण एनीमेशन सही स्थिति नहीं है।
int currentFeedIndex = Application.getInstance().getCurrentViewingFeed();
if (currentFeedIndex > 0 && currentFeedIndex < adapter.getItemCount()) {
if (gridLayoutManager != null) {
gridLayoutManager.scrollToPositionWithOffset(currentFeedIndex + 1, 0);
}
}
मैं जिस तरह से बाहर निकलने के एनीमेशन चलाने से पहले जोड़ी सूची को बदलने के लिए की तलाश में हूँ
अद्यतन: यहाँ DetailActivity, जहां मैं विचारों के लिए संक्रमण नाम आवंटित के लेआउट है
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgFeed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transitionName="TransitionName.Feed.Image" />
<TextView
android:id="@+id/tvLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:transitionName="TransitionName.Feed.Text"/>
<Button
android:transitionName="TransitionName.Feed.Button"
android:id="@+id/btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_below="@+id/tvLogo"/>
</RelativeLayout>
आप कोड कैसे आप संक्रमण आवंटित किया पोस्ट कर सके 'DetailActivity' के विचारों के नाम? – rom4ek
@ rom4ek मैंने कोड – R4j