java Android工具栏不显示
我正在开发一款原生安卓应用。 它包含一个工具栏,这是xml代码
<?xml version="1.0" encoding="utf-8"?>
<安卓.support.design.widget.CoordinatorLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:app="http://schemas.安卓.com/apk/res-auto"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:fitsSystemWindows="true"
tools:context=".MainActivity">
<安卓.support.design.widget.AppBarLayout
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:theme="@style/AppTheme.AppBarOverlay">
<安卓.support.v7.widget.Toolbar
安卓:id="@+id/toolbar"
安卓:layout_width="match_parent"
安卓:layout_height="?attr/actionBarSize"
安卓:titleTextColor="@color/maroon"
app:theme="@style/ToolBarStyle"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</安卓.support.design.widget.AppBarLayout>
<include layout="@layout/activity_home" />
<安卓.support.design.widget.FloatingActionButton
安卓:id="@+id/fab"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_gravity="bottom|end"
安卓:layout_margin="@dimen/fab_margin"
安卓:src="@安卓:drawable/ic_dialog_dialer"
安卓:background="@color/maroon"
安卓:visibility="gone" />
</安卓.support.design.widget.CoordinatorLayout>
活动代码:
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
在智能手机上tooblar可以正常工作,而在平板电脑(4.x)上则无法显示。 知道吗
共 (0) 个答案