【发布时间】:2018-08-07 15:46:50
【问题描述】:
我决定制作自己的工具栏
所以我删除了常规工具栏:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar> //removetollbar
制作我自己的工具栏
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.Toolbar>
然后我包含在主 xml 中
<include
layout="@layout/customtoolbar"
android:id="@+id/custombar" >
</include>
我在代码中设置了它:
_CustomToolBar = (android.support.v7.widget.Toolbar)
findViewById(R.id.custombar);
setSupportActionBar(_CustomToolBar);
android.support.v7.widget.Toolbar _CustomToolBar;
现在当应用运行时自定义工具栏不存在
请帮忙。
【问题讨论】:
-
您的意思是说活动打开但工具栏不可见?
标签: java android android-layout material-design android-toolbar