2017-09-20 14 views
9

यहां हम जाते हैं: एक साझा तत्व संक्रमण (बटन) के साथ दो गतिविधियां। दूसरा Activity एक संकेत के साथ एक TextInputLayout है:TextInputLayout साझा तत्व संक्रमण समस्या

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:app="http://schemas.android.com/apk/res-auto" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:focusable="true" 
       android:focusableInTouchMode="true" 
       android:gravity="center_horizontal" 
       android:orientation="vertical"> 

    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" 
      android:text="GO" 
      android:transitionName="test"/> 

    <android.support.design.widget.TextInputLayout android:layout_width="match_parent" 
                android:layout_height="wrap_content" 
                android:hint="WTF?!"> 
     <android.support.design.widget.TextInputEditText android:layout_width="match_parent" 
                 android:layout_height="wrap_content"/> 
    </android.support.design.widget.TextInputLayout> 
</LinearLayout> 

दूसरा Activity के संक्रमण में प्रवेश समस्या स्पष्ट करने के लिए देरी हो रही है: TextInputLayout का संकेत संक्रमण एनीमेशन ध्यान नहीं देता और बाद संक्रमण शुरू कर दिया है तुरंत प्रदर्शन किया। एनीमेशन के अंत में आप संकेत के नीचे सही ढंग से एनिमेटेड एडिटटेक्स्ट पृष्ठभूमि (क्षैतिज रेखा) देख सकते हैं। क्या यह बग है या मैं कुछ भूल गया हूं? यहाँ दूसरे Activity है:

public class SecondActivity extends AppCompatActivity { 

    public static void launch(Activity activity, View sharedElement) { 
     Intent intent = new Intent(activity, SecondActivity.class); 

     ActivityOptionsCompat options = ActivityOptionsCompat. 
       makeSceneTransitionAnimation(activity, sharedElement, "test"); 
     activity.startActivity(intent, options.toBundle()); 
    } 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_second); 

     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 
      getWindow().setEnterTransition(new Slide().setDuration(5000)); 
     } 
    } 
} 

संपादित करें: इस बग एक पृष्ठभूमि दूसरी गतिविधि के लेआउट जोड़कर "तय" हो सकता है।

without backgroundwith background

+0

आपका साझा तत्व कौन सा है? आप क्या होने की उम्मीद करते हैं? – azizbekian

+0

साझा तत्व बटन है, जैसा कि आप उदाहरण कोड से देख सकते हैं। उम्मीद है कि टेक्स्ट इनपुटपुट का संकेत गतिविधि संक्रमण के एक हिस्से के रूप में ठीक से एनिमेटेड है, जैसे बाकी दृश्य (वीडियो में एडिटटेक्स्ट की पृष्ठभूमि के उचित संक्रमण को देखें)। – artkoenig

+0

कृपया, अपने प्रश्न को स्पष्ट करें। आपका एनिमेटेड जीआईएफ अच्छा लग रहा है, हमें मिल गया है। यह बहुत अच्छा एनीमेशन है। लेकिन मैं समझ नहीं पा रहा हूं, समस्या क्या है? वह कहां है? अगर नीली रेखा बढ़ जाती है तो मैं क्या देखता हूं। बस इतना ही। और फिर इनपुट क्षेत्र के नीचे एक छोटी झपकी रेखा दिखाई देती है। क्या इसकी उम्मीद है? क्या इसकी उम्मीद नहीं है? WTF? – babay

उत्तर

0

मैं TextInputLayout के अपने बग लगता है। मैंने इसे हटा दिया और मैंने संकेत दिया TextInputEditText और यह आपके काम के अनुसार काम किया।

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:focusable="true" 
    android:focusableInTouchMode="true" 
    android:gravity="center_horizontal" 
    android:orientation="vertical"> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="GO" 
     android:transitionName="test" /> 


    <android.support.design.widget.TextInputEditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="WTF?!" /> 

</LinearLayout> 
0

एक बग लगता है। मैंने new issue जमा किया।

आप दूसरी गतिविधि के लिए android:background को परिभाषित करके इससे बच सकते हैं।

0
एपीआई 21+ के लिए

android:transitionGroup="true" 

TextInputLayout में इस लाइन में जोड़ें। यह ठीक करेगा। या यदि आपके पास कुछ TextInputLayout हैं तो उस पंक्ति को उनके कंटेनर में जोड़ें।

संबंधित मुद्दे