Android Toolbar 的 padding 比 ActionBar 多,如何解决
Android Toolbar has more padding than ActionBar, how to fix
我不得不更换操作栏以实现设计团队想要的新 UI 模式
操作栏现在已替换为工具栏,但工具栏对象比操作栏大,只是略微大一点,但它很明显且不需要
这是XML声明
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
如何缩小它?我曾经能够依赖已经为每个屏幕尺寸预定义的 actionBarSize
,我可以输入特定的 dp 值,但这是这个对象的解决方案吗?
谢谢
?attr/actionBarSize 是 56dp,带有新的支持库。因此,即使您坚持使用操作栏,您也会获得更大的尺寸。在您的主题中设置 actionBarSize。
我不得不更换操作栏以实现设计团队想要的新 UI 模式
操作栏现在已替换为工具栏,但工具栏对象比操作栏大,只是略微大一点,但它很明显且不需要
这是XML声明
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
如何缩小它?我曾经能够依赖已经为每个屏幕尺寸预定义的 actionBarSize
,我可以输入特定的 dp 值,但这是这个对象的解决方案吗?
谢谢
?attr/actionBarSize 是 56dp,带有新的支持库。因此,即使您坚持使用操作栏,您也会获得更大的尺寸。在您的主题中设置 actionBarSize。