android编程中出现的小问题及解决方法(连载)

 1.(2012-1-16)动态设置EditText为密码形式。

解答:因为没有setPassword()或者像setPhoneNumber()这样的函数,所以有必要找到解决的方法。

实际上,是通过edittext.setTransformationMethod(HideReturnsTransformationMethod.getInstance();来设置显示明文;通过setTransformationMethod(PasswordTransformationMethod.getInstance();来显示密码。

2.在程序中动态改变语系和其他配置。

解答:


  1. Resources resources = getResources(); 
  2. Configuration configuration = resources.getConfiguration(); 
  3. configuration.locale = Locale.CHINESE; 
  4. DisplayMetrics dm = resources.getDisplayMetrics(); 
  5. resources.updateConfiguration(configuration, dm); 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章