現在、多くのアクティビティで構成されている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>
Androidの組み込みViewFlipperクラスは良いアプローチのようです。そうすれば、同様の「ページ」を1つのアクティビティにまとめることができます。それでも、別個の活動でこれが可能であるかどうかを知ることは興味深いでしょう! – Preyes