0

我有以下代码:

setContentView(R.layout.activity_main);

ActionBar mActionBar = getActionBar();
if (mActionBar != null) {
    mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
}
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.action_bar_search, null,false);

关于null(膨胀的第二个参数)我得到:避免将null作为视图根传递(需要解析膨胀布局的根元素上的布局参数)。我读到传递 null 是可以的,但我承认我喜欢让我的代码尽可能干净。

为 a 充气时fragment,我有容器,但我没有找到要在此处传递的内容,以避免出现此警告。

请指教 谢谢

4

0 回答 0