简体   繁体   English

android:onClick 按钮工作缓慢

[英]android:onClick is working slow for button

XML code for going from SignUp Page to Phone verification Page: XML 代码用于从注册页面转到电话验证页面:

<Button
    android:id="@+id/signup_btn"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="55dp"
    android:background="@drawable/btn"
    android:text="Sign up"
    android:onClick="toPhoneNumber"
    android:textColor="#fff"
    android:textColorLink="#CFC8C8"/>

Further Java File Code:进一步 Java 文件代码:

 public void toPhoneNumber(View view) {
    startActivity(new Intent(this,SignUp2nd.class));
}

Ayush Dubey try addonclicklistner instead on OnClick I hope this will help you. Ayush Dubey在 OnClick 上尝试addonclicklistner我希望这会对你有所帮助。 here its documentation: https://developer.android.com/reference/android/widget/Button这里是它的文档: https://developer.android.com/reference/android/widget/Button

Example:例子:

  button.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 // Code here executes on main thread after user presses button
             }
         });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM