2017-12-29 18 views
1

私は2つのアクティビティの間にshared element transitionを使用しています。新しいアクティビティでは、私はshared preferencesを使用して共有ビューの値を設定しています。しかし、初めてアニメーションを使用しているときに値が表示されません。 2回目以降、値が表示されます。アニメーションがなければ、すべてうまくいく。共有要素移行アクティビティ

Intent intent = new Intent(getActivity(), ProfileActivity.class); 
ActivityOptionsCompat optionsCompat=ActivityOptionsCompat.makeSceneTransitionAnimation(mActivity,(View) v_profile,getString(R.string.mobile)); 
       startActivity(intent,optionsCompat.toBundle()); 

<android.support.v7.widget.CardView 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       card_view:cardElevation="10dp" 
 
       android:layout_margin="10dp" 
 
       android:id="@+id/profile_Cardview" 
 
       android:transitionName="@string/mobile" 
 
       > 
 
       <LinearLayout 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:orientation="vertical" 
 
       android:padding="15dp"> 
 
       <TextView 
 
       android:id="@+id/mobile_no" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:gravity="start" 
 
       android:text="@string/mobile" 
 
       style="@style/light_text" 
 
       android:layout_marginBottom="4dp" 
 

 
       /> 
 

 

 
      <TextView 
 
       android:id="@+id/pf_tv_mobile_no" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:gravity="start" 
 
       android:layout_marginBottom="4dp" 
 
       android:singleLine="true" 
 
       style="@style/light_text" 
 

 
       /> 
 

 
      <View 
 
       android:layout_height="1dp" 
 
       android:layout_width="match_parent" 
 
       android:background="@color/grey" 
 
       android:layout_marginBottom="8dp" 
 
       /> 
 

 

 
      <TextView 
 
       android:id="@+id/pf_tv_agency_label_" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:gravity="start" 
 
       android:text="@string/agency_label" 
 
       style="@style/light_text" 
 
       android:layout_marginBottom="4dp" 
 

 
       /> 
 

 

 
      <EditText 
 
       android:id="@+id/pf_tv_agency_name" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:gravity="start" 
 
       android:layout_marginBottom="4dp" 
 
       android:singleLine="true" 
 
       android:inputType="text" 
 
       style="@style/normal_text" 
 
       /> 
 

 

 
      <TextView 
 
       android:id="@+id/pf_tv_mobile_label" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:gravity="start" 
 
       android:text="@string/paytm" 
 
       style="@style/light_text" 
 
       android:layout_marginBottom="4dp" 
 

 
       /> 
 

 

 
      <EditText 
 
       android:id="@+id/pf_tv_paytm_no" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:gravity="start" 
 
       android:layout_marginBottom="4dp" 
 
       android:singleLine="true" 
 
       android:inputType="text" 
 
       style="@style/normal_text" 
 
       /> 
 

 

 
      <!-- <View 
 
        android:layout_height="1dp" 
 
        android:layout_width="match_parent" 
 
        android:background="@color/grey" 
 
        android:layout_marginBottom="8dp" 
 
        />--> 
 

 

 
      <TextView 
 
       android:id="@+id/pf_tv_agency_label" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:gravity="start" 
 
       android:text="@string/bhim_label" 
 
       style="@style/light_text" 
 
       android:layout_marginBottom="2dp" 
 
       /> 
 

 

 

 
      <EditText 
 
       android:id="@+id/pf_tv_bhim_no" 
 
       style="@style/normal_text" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:gravity="start" 
 
       android:singleLine="true" 
 
       android:layout_marginBottom="8dp" 
 
       android:inputType="text" 
 
       /> 
 
      </LinearLayout> 
 
</android.support.v7.widget.CardView>

activity.xmlプロファイルで私はsharedpreferencesからのEditTextの値を設定しています。

答えて

1

私はそれを解決しました。最初の編集テキストに集中すると、 rootView.(findViewById(R.id.pf_tv_agency_name)).requestFocus()onActivityCreated()に表示されます。フィールドはいっぱいになります。

関連する問題