Android APP开发时,添加了一个AlertDialog提示框,设置了确定、取消按钮,但运行之后按钮文字显示不出来,怎么解决呢?
下面是代码
-
- LayoutInflater factory = LayoutInflater.from(MainActivity.this);//提示框
- final View view = factory.inflate(R.layout.activation_main, null);//这里必须是final的
- final EditText edit=(EditText)view.findViewById(R.id.editText);//获得输入框对象
-
- AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
- final AlertDialog dialog = builder.create();
- //post.setAlertDialog(dialog);
- builder.setTitle("激活码");//提示框标题
- builder.setView(view);
- builder.setCancelable(false);
- builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- // String Codestr = edit.getText().toString();
- // post.sendPostMessage(MACstr,Codestr,code);
- }
- });
- //设置反面按钮
- builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- System.exit(0);
- }
- });
-
- builder.setNeutralButton("试用", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Toast.makeText(MainActivity.this, "试用", Toast.LENGTH_SHORT).show();
- dialog.dismiss();
- }
- });
- builder.show();
这是显示的图片,文字显示不出来,但是button按钮还在,点击有效果