我正在构建一个Android应用程序,该应用程序目前包含许多活动,每个活动的顶部都有一个自定义 LinearLayout 标题栏。
当我更改活动时,默认动画会导致整个页面滑动,而理想情况下我希望标题栏保持静态。由于标题栏通常在多个页面中包含相同的文本,因此动画似乎是不必要的。
Spotify的Android应用程序是我的意思的完美例子。如果您导航到“更多”并点击“设置”,则页面内容会滑过,但标题栏不会。
如果有人有任何见解,我将不胜感激!
标题栏布局:
<?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>
答案 0 :(得分:1)
理想情况下,我希望标题栏保持静止
这是不可能的,抱歉。
Spotify的Android应用程序是我的意思的完美例子。如果您导航到“更多”并点击“设置”,则页面内容会滑过,但标题栏不会。
那些不是多重活动。正如@Preyes指出的那样,他们可能正在使用ViewFlipper
。