一、模板代码
<!--自定义标题栏-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:layout_height="60dp"
android:background="@color/colorPrimary"
android:paddingLeft="18dp"
android:paddingRight="18dp"
android:id="@+id/title">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/app_name"
android:textSize="20sp"
android:textColor="#646464"/>
<TextView
android:id="@+id/tvPlus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="+"
android:textColor="#646464"
android:textSize="40sp"/>
</LinearLayout>
二、备注
将“模板代码”填充在XML文件头部,在Java中隐藏系统标题栏即可。