gpt4 book ai didi

android - 当方向改变时,Actionbar scherlock 不会刷新

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:33:37 26 4
gpt4 key购买 nike

我在我的应用程序中使用 Sherlock 操作栏。我在菜单中使用了“ifRoom|withText”功能。如果我在纵向模式下测试我的代码,我只能看到图标,如果我将方向旋转为横向,我仍然只能看到图标。另一方面,如果我横向运行,我可以在纵向和横向上看到文字和图标。这意味着当屏幕旋转时,操作栏不会刷新。我该如何解决?

在菜单中,我有

    android:showAsAction="ifRoom|withText"

我也在我的 list 文件中使用了这一行来修复

    android:configChanges="keyboardHidden|orientation|screenSize"

但是没有用。然后我运行我的代码 android 2.3

我还在我的 Activity 中使用了 fragment ,

        FragmentManager fm = getSupportFragmentManager();
ft = fm.beginTransaction();

mFragment1 = fm.findFragmentByTag("f1");

if (mFragment1 == null) {

mFragment1 = new MenuFragment();
ft.add(mFragment1, "f1");

}

ft.commit();

最佳答案

ActionBarSherlock 不支持处理配置更改。

在 pre-ICS 上,ActionBarSherlock 不像原生操作栏那样是装饰 View 的一部分,因此受到与内容 View 相同的限制。通过处理配置更改,您不允许库适应更改,因此会看到不正确的显示或某些部分。

Android 文档也不鼓励处理配置更改。不惜一切代价避免使用它们,尤其是在使用 ActionBarSherlock 时。

在相关说明中,我仍在尝试为库的 future 版本解决这个问题,但现在建议避免。

关于android - 当方向改变时,Actionbar scherlock 不会刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10589676/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com