美文网首页
android自定义StatusBar车机版(二、添加自己的标题

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

作者: MrDemo | 来源:发表于2024-04-10 09:25 被阅读0次

    一、修改路径
    /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

    相关文章

      网友评论

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

          本文链接:https://www.haomeiwen.com/subject/jrsqxjtx.html