为什么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