android - 如何在android中隐藏actionbar show和hide的动画?

标签 android android-layout android-fragments android-actionbar

我有一个包含 tabhost 的 Activity 。我为 tabhost 使用了多个 fragment ,每个选项卡只有一个 fragment ,这意味着 fragment 大小与父级匹配。但是,并非所有 fragment 都有操作栏。

For example, the first one hide actionbar while the other show the actionbar.

问题是,当我显示/隐藏操作栏时,它不会立即进行交易,但它有一个胺化,例如对于 hide->show 的情况,actionbar 被隐藏并在屏幕上留出一个空白区域,然后内容屏幕将扩展以适合屏幕。它会在 ui 中造成一些“故障”,那么有什么办法可以修复它吗?

我尝试了 requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERL‌ AY); 动画是隐藏的,但操作栏是覆盖内容而不是部分内容,

更新:

actionbar 的 overlay 就像这个截图,它在内容之上。请看一下

http://www.thekirankumar.com/blog/wp-content/uploads/2013/02/picasion.com_1060caff20a6f01365ae6ec4728f0c86.gif

最佳答案

请在此处查看 requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERL‌ AY);

Using ActionBarSherlock; experiencing View.getLocationOnScreen() inconsistency between 2.2 and ICS/JB

关于 hide 和 show 方法,您能否确认您是否在 fragment 的 onCreate 方法中调用它?

你能把你打电话的代码贴出来吗?

关于android - 如何在android中隐藏actionbar show和hide的动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21824472/

相关文章:

Android 媒体播放器和搜索栏同步问题

java - fragment getActivity() 与接口(interface)回调?

Viewpager Fragment 中的 Android Listview - 无滚动

android - 在 FragmentTransaction 之后调用什么方法

android - 如何使 RadioGroup 在 Android 中可滚动?

java - 我在 GridLayout 中遇到问题,我想在里面显示 49 个按钮,但它不起作用 Android Studio

android - EditText 中的 "word-wrap: break-word"

Android 集成 AdWhirl 和 AdMob

android - CustomView 的这种技巧安全吗?

android - 使用 GridLayout 编辑屏幕外的文本