android自定义StatusBar车机版(二、添加自己的标题

2024-04-10  本文已影响0人  MrDemo

一、修改路径
/home/ss/Work4.3-X9/buildsystem/android10/frameworks/base/packages/CarSystemUI/res/layout/super_status_bar.xml
二、将里面car_top_navigation_bar替换成自己的布局就可以了
替换之前的代码是(大概在layout/super_status_bar.xml的第61行)

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/status_bar_height"
        android:orientation="vertical"
        android:background="@drawable/main_bg_top"
    >
        <FrameLayout
            android:id="@+id/status_bar_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone"
        />

        <include layout="@layout/car_top_navigation_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
        />
    </LinearLayout>

替换完成的代码

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/status_bar_height"
        android:orientation="vertical"
        android:background="@drawable/main_bg_top"
    >
        <FrameLayout
            android:id="@+id/status_bar_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone"
        />

        <include layout="@layout/top_nva"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
        />
    </LinearLayout>

经过替换导航栏与状态栏后,我们开机后的页面就变成了如下


screen.png
上一篇下一篇

猜你喜欢

热点阅读