Android支持库工具栏不会在方向更改时调整大小

时间:2015-02-16 22:51:58

标签: android android-support-library android-toolbar

我的工具栏声明如下:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    app:theme="@style/ThemeOverlay.AppCompat.ActionBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"/>

在方向改变时,它的高度保持不变(尽管字体改变了大小并且小部件内部重新排列)。

我如何解决这个问题,使其行为正常,就像动作栏一样?

1 个答案:

答案 0 :(得分:0)

这可以解决你的问题:

    android:layout_height="?attr/actionBarSize"
相关问题