如果使用locale 可以进行语言转换,但是好像不能马上进行转换,要重新启动才开始
如果想马上实现效果 resource.updateConfiguration()更新一下
如果更新后还想做一写什么
android:configChanges="locale"
@Override
public void onConfigurationChanged(Configuration newConfig) {
// 更新一下吧
super.onConfigurationChanged(newConfig);
}
2.
AlertDialog.Builder builder;
AlertDialog alertDialog;
Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater)
mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog,
(ViewGroup) findViewById(R.id.layout_root));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Hello, this is a custom dialog!");
ImageView image = (ImageView) layout.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
builder = new AlertDialog.Builder(mContext);
builder.setView(layout);
alertDialog = builder.create();