簡體   English   中英

android:onClick 按鈕工作緩慢

[英]android:onClick is working slow for button

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"/>

進一步 Java 文件代碼:

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

Ayush Dubey在 OnClick 上嘗試addonclicklistner我希望這會對你有所幫助。 這里是它的文檔: https://developer.android.com/reference/android/widget/Button

例子:

  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