0
后失踪Appbar我有以下方法的细节片段:Android的 - 爪哇 - 旋转
> @Override
public void onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
if (getArguments().containsKey(ARG_ITEM_ID))
{
final Activity activity = this.getActivity();
final CollapsingToolbarLayout appBarLayout = activity.findViewById(R.id.toolbar_layout);
if (appBarLayout != null)
{
int index = getArguments().getInt(ARG_ITEM_ID);
appBarLayout.setTitle(getArguments().getString(ARG_TITLE));
}
}
}
这工作完全当我进入片段,在正常或横向模式。不过,当我输入并切换方向时,appBarLayout始终为空。 问题是什么?
此外,当我输入时,此工具栏始终处于折叠状态。 有没有办法保持它进入“小”,只有在向下滚动时折叠?