Android响应工具栏高度
我们知道,纵向(56dp)和横向(48dp)工具栏的高度应该不同。是否有办法使工具栏在方向更改时更改其高度(并缩放标题和图像) 我强烈希望将这一行保存在AndroidManifest中,因为它对于其他用途非常有用:Android响应工具栏高度,android,android-layout,android-toolbar,android-orientation,Android,Android Layout,Android Toolbar,Android Orientation,我们知道,纵向(56dp)和横向(48dp)工具栏的高度应该不同。是否有办法使工具栏在方向更改时更改其高度(并缩放标题和图像) 我强烈希望将这一行保存在AndroidManifest中,因为它对于其他用途非常有用: android:configChanges="orientation|screenSize" (工具栏停留在搜索菜单中是很有用的。如果没有android:configChanges,我真的不知道有什么好方法可以做到这一点)有一种难看的方法,你知道它的高度是多少,通过使用自定义文本视
android:configChanges="orientation|screenSize"
(工具栏停留在搜索菜单中是很有用的。如果没有android:configChanges,我真的不知道有什么好方法可以做到这一点)有一种难看的方法,你知道它的高度是多少,通过使用自定义
文本视图
作为工具栏中的标题
,然后在用户旋转手机时缩放所有内容
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" >
<TextView
android:textColor="?android:textColorPrimary"
android:id="@+id/titleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</android.support.v7.widget.Toolbar>
有一种丑陋的方法可以做到这一点,你知道高度是多少,方法是使用自定义的
文本视图作为工具栏中的标题,然后在用户旋转手机时缩放所有内容
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" >
<TextView
android:textColor="?android:textColorPrimary"
android:id="@+id/titleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</android.support.v7.widget.Toolbar>