爲什麼Snacbar文本無法顯示在已簽名的APK上?這裏是調試APK的代碼。我也啓用了proguard。這是否因爲進步而發生?Android Sncabar文本無法顯示在帶有proguard的已簽名APK上
if (intent.hasExtra(KEY_ERROR_MESSAGE)) {
String msg = intent.getStringExtra(KEY_ERROR_MESSAGE);
Snackbar snack = Snackbar.make(findViewById(android.R.id.content), msg, Snackbar.LENGTH_LONG);
View view = snack.getView();
view.setBackgroundColor(ContextCompat.getColor(SignupActivity.this, R.color.red_EC1C24));
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(ContextCompat.getColor(SignupActivity.this, R.color.accent));
tv.setGravity(Gravity.CENTER_HORIZONTAL);
snack.show();
}
編輯:
intent.hasExtra(KEY_ERROR_MESSAGE)
回報true
但intent.getStringExtra(KEY_ERROR_MESSAGE)
回報null
不是預期的String
什麼是ProGuard的規則應該怎麼使用?
沒有你想註釋行4-9和測試您的應用程序? – Amir
並給Snackbar.make()另一個視圖,而不是android.R.id.content – Amir