更改活动时防止标题栏动画

3
我正在开发一款Android应用,目前它由多个活动组成,每个活动都有一个自定义的 LinearLayout 标题栏位于顶部。
当我切换活动时,默认动画会导致整个页面滑动,而我希望标题栏保持静态。由于标题栏在多个页面中通常包含相同的文本,因此动画似乎是不必要的。
Spotify的Android应用程序是我想表达的完美例子。如果您导航到'More'并单击'Settings',则页面内容会滑动,但标题栏不会。
如果有人有任何见解,将不胜感激! 标题栏布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:background="@layout/bg_menubar"
android:paddingLeft="14dp">

<TextView android:text="APP_NAME"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="#ffffff"
    android:textStyle="bold"
    android:shadowColor="#231f20"
    android:shadowRadius="1.6"
    android:shadowDx="1.5"
    android:shadowDy="1.3" />

<ImageView android:layout_width="1px"
    android:layout_height="fill_parent"
    android:background="#00113a"
    android:layout_marginLeft="14dp" />     
<ImageView android:layout_width="1px"
    android:layout_height="fill_parent"
    android:background="#8b979f"
    android:layout_marginRight="14dp" />

<TextView android:id="@+id/tv_title"
    android:text="Dashboard"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="#ffffff"
    android:textStyle="bold"
    android:shadowColor="#231f20"
    android:shadowRadius="1.6"
    android:shadowDx="1.5"
    android:shadowDy="1.3" />
</LinearLayout>

Android内置的ViewFlipper类似乎是一个不错的方法。这样我就可以将相似的“页面”捆绑到一个活动中。不过,如果能够在单独的活动中实现这一点,那就更有趣了! - Preyes
1个回答

1

理想情况下,我希望标题栏保持静态不动。

很抱歉,这是不可能的。

Spotify 的 Android 应用程序是我所说的完美例子。如果您导航到“更多”并单击“设置”,页面内容会滑动,但标题栏不会。

那么它们就不是多个活动了。正如 @Preyes 所指出的,他们可能正在使用 ViewFlipper


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接