"避免传递null作为视图根"通过AlertDialog充气视图以供使用时警告视图、以供、QUOT、null

由网友(一夜七次)分享简介:我得到的皮棉警告,避免传递null作为视图根膨胀与空的意见时,如父,如:I get the lint warning, Avoid passing null as the view root when inflating views with null as parent, like:LayoutInflater....

我得到的皮棉警告,避免传递null作为视图根膨胀与的意见时,如,如:

I get the lint warning, Avoid passing null as the view root when inflating views with null as parent, like:

LayoutInflater.from(context).inflate(R.layout.dialog_edit, null);

不过,鉴于被用作对内容的 AlertDialog ,使用的setView AlertDialog.Builder ,所以我不知道应该怎样传递的

However, the view is to be used as the content of an AlertDialog, using setView on AlertDialog.Builder, so I don't know what should be passed as the parent.

你觉得在应该是在这种情况下?

What do you think the parent should be in this case?

推荐答案

使用这种code膨胀对话视图没有警告:

Use this code to inflate the dialog view without a warning:

View.inflate(context, R.layout.dialog_edit, null);
阅读全文

相关推荐

最新文章