我阅读了一些代码并发现了类似的内容,例如见下文。
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.custom_dialog);
dialog.show();
// What is the purpose of parentheses here? Is there any benefit?
(dialog.findViewById(R.id.button)).setOnClickListener(v -> Log.e(TAG, "OK"));
// instead of
dialog.findViewById(R.id.button).setOnClickListener(v -> Log.e(TAG, "OK"));
谢谢。
catspeake
相关分类