Привет, я разрабатываю приложение, в котором я использую переход общего элемента в текстовом представлении, однако, когда я применяю анимацию, ничего не происходит, и, кроме того, текст в другом действии становится невидимым, что довольно странно, я дал одно и то же имя перехода для обоих действий, но я не понимаю, что проблема. пожалуйста, если кто-нибудь может мне помочь здесь.
вот активность входа
<?xml version = "1.0" encoding = "utf-8"?>
<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:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical"
tools:context = "com.ct.listrtrial.activities.LoginActivity"
android:background = "@color/colorPrimary">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_marginLeft = "10dp"
android:layout_marginTop = "30dp"
android:text = "Login"
android:transitionName = "@string/transition_name_signup"
android:id = "@+id/text_login"
android:textColor = "@color/White"
android:textSize = "35sp" />
<android.support.v7.widget.CardView
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_marginLeft = "10dp"
android:layout_marginRight = "10dp"
android:layout_marginTop = "25dp"
android:id = "@+id/login_card"
app:cardBackgroundColor = "@color/White"
app:cardCornerRadius = "20dp"
app:cardElevation = "5dp">
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "vertical">
<com.ct.listrtrial.Custom.CustomEditText
android:layout_width = "match_parent"
android:layout_height = "80dp"
android:paddingLeft = "10dp"
android:id = "@+id/text_input_email"
>
<com.ct.listrtrial.Custom.TextInputEditText
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:drawableLeft = "@drawable/message"
android:drawablePadding = "10dp"
android:hint = "Email id"
android:background = "@android:color/transparent"/>
</com.ct.listrtrial.Custom.CustomEditText>
<View
android:id = "@+id/card_divider"
android:layout_width = "match_parent"
android:layout_height = "1dp"
android:background = "@color/light_black"
/>
<com.ct.listrtrial.Custom.CustomEditText
android:layout_width = "match_parent"
android:layout_height = "80dp"
android:paddingLeft = "10dp"
android:id = "@+id/text_input_password"
>
<com.ct.listrtrial.Custom.TextInputEditText
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:drawableLeft = "@drawable/lock"
android:drawablePadding = "10dp"
android:hint = "Password"
android:background = "@android:color/transparent"/>
</com.ct.listrtrial.Custom.CustomEditText>
</LinearLayout>
</android.support.v7.widget.CardView>
<RelativeLayout
android:layout_width = "wrap_content"
android:layout_height = "wrap_content">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_marginRight = "10dp"
android:layout_marginTop = "15dp"
android:text = "Forgot Password?"
android:id = "@+id/text_forgot_password"
android:textColor = "@color/White"
android:textSize = "18sp" />
</RelativeLayout>
<com.ct.listrtrial.widget.CustomButton
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_gravity = "bottom"
android:background = "@drawable/ripple_button_effect"
android:layout_marginBottom = "16dp"
android:layout_marginLeft = "10dp"
android:layout_marginRight = "10dp"
android:layout_marginTop = "15dp"
android:paddingLeft = "10dp"
android:paddingRight = "10dp"
android:text = "Login"
android:id = "@+id/login_button"
android:textSize = "20sp" />
<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerInParent = "true"
android:text = "OR CONNECT WITH"
android:textColor = "@color/White"
android:textSize = "15sp" />
</RelativeLayout>
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_marginTop = "5dp"
android:orientation = "horizontal"
>
<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_marginBottom = "20dp"
android:layout_marginTop = "10dp"
android:layout_marginRight = "50dp"
>
<com.ct.listrtrial.Custom.GoofleCustomImageView
android:id = "@+id/facebook_image"
android:layout_width = "wrap_content"
android:layout_height = "45dp"
android:layout_centerInParent = "true"
android:layout_marginRight = "10dp"
android:adjustViewBounds = "true"
android:scaleType = "centerCrop"
android:src = "@drawable/facebook"
/>
<com.ct.listrtrial.Custom.GoofleCustomImageView
android:id = "@+id/google_image"
android:layout_width = "wrap_content"
android:layout_height = "45dp"
android:layout_marginLeft = "10dp"
android:layout_toRightOf = "@+id/facebook_image"
android:adjustViewBounds = "true"
android:scaleType = "centerCrop"
android:src = "@drawable/google_plus_1" />
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:layout_width = "match_parent"
android:layout_height = "250dp">
<ImageView
android:id = "@+id/login_page_curve"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:onClick = "gotoregister"
android:src = "@drawable/login_page_curve" />
<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_marginTop = "20dp"
android:orientation = "horizontal"
>
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id = "@+id/or_text"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_marginLeft = "130dp"
android:text = "Or"
android:layout_marginTop = "10dp"
android:textColor = "@color/black"
android:textSize = "17sp" />
<com.ct.listrtrial.Custom.CustomTextViewBold
android:id = "@+id/register_text"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_toRightOf = "@+id/or_text"
android:text = "Register"
android:layout_marginTop = "10dp"
android:layout_marginLeft = "10dp"
android:textColor = "@color/black"
android:textSize = "17sp" />
</RelativeLayout>
</FrameLayout>
</LinearLayout>
Активность входа
public class LoginActivity extends AppCompatActivity {
CustomEditText text_input_email,text_input_password;
CustomButton login_button;
GoofleCustomImageView google_image,facebook_image;
ImageView login_page_curve;
CustomTextViewMedium or_text,text_forgot_password,text_login;
CustomTextViewBold register_text;
View myView;
boolean isUp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
initViews();
}
public void initViews(){
text_input_email = (CustomEditText)findViewById(R.id.text_input_email);
text_input_password = (CustomEditText)findViewById(R.id.text_input_password);
login_button = (CustomButton)findViewById(R.id.login_button);
google_image = (GoofleCustomImageView) findViewById(R.id.google_image);
facebook_image = (GoofleCustomImageView) findViewById(R.id.facebook_image);
login_page_curve = (ImageView)findViewById(R.id.login_page_curve);
or_text = (CustomTextViewMedium)findViewById(R.id.or_text);
text_forgot_password = (CustomTextViewMedium)findViewById(R.id.text_forgot_password);
register_text = (CustomTextViewBold)findViewById(R.id.register_text);
text_login = (CustomTextViewMedium)findViewById(R.id.text_login);
}
public void gotoregister(View view) {
Intent intent = new Intent(LoginActivity.this,RegisterActivity.class);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation
(LoginActivity.this,login_page_curve,
getResources().getString(R.string.transition_name_signup));
startActivity(intent,options.toBundle());
overridePendingTransition(R.anim.bottom_up,R.anim.bottom_down);
finish();
}
}
да, я запускаю приложение на API> = 21
Вы передаете login_page_curve в параметрах вместо CustomTextViewMedium, для которого определено TransitionName
Я знаю, что даже когда я передаю текстовое представление, он не работает. так что я подумал о каком-то эксперименте ..
Попробуйте удалить этот overridePendingTransition()




На всякий случай, вы запускаете приложение на устройстве с API> = 21?