1.(2012-1-16)動態設置EditText爲密碼形式。
解答:因爲沒有setPassword()或者像setPhoneNumber()這樣的函數,所以有必要找到解決的方法。
實際上,是通過edittext.setTransformationMethod(HideReturnsTransformationMethod.getInstance();來設置顯示明文;通過setTransformationMethod(PasswordTransformationMethod.getInstance();來顯示密碼。
2.在程序中動態改變語系和其他配置。
解答:
- Resources resources = getResources();
- Configuration configuration = resources.getConfiguration();
- configuration.locale = Locale.CHINESE;
- DisplayMetrics dm = resources.getDisplayMetrics();
- resources.updateConfiguration(configuration, dm);