Android的工具栏动作按钮的高度 [英] Android Toolbar Action button height
问题描述
我 RES /布局/ toolbar.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_width="match_parent"
android:layout_height="?actionBarSize"
android:elevation="4dp"
style="@style/ToolbarStyle">
</android.support.v7.widget.Toolbar>
下面是我的工具栏的使用:
Here is my usage of toolbar:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar" />
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
我包括在操作按钮显示和工作如预期的活动,但有一件事是动作按钮pressed亮点放不下工具栏
I include it in any Activity
Action buttons are shown and work as expected but there is one thing that action button pressed highlight does not fit toolbar
有没有人遇到这样的问题?
Has anyone faced this kind of problem?
感谢您
推荐答案
这应该是一个评论,但我实在是太长了。
It should be a comment, but I it is too long.
这是一个材料规格
正如你在附图片中看到,工具栏高度64dp片剂(在智能手机56dp),而操作按钮高度48dp。
As you can see in the picture attached, the toolbar height is 64dp in tablet (56dp in smartphone), while the action button height is 48dp.
您也可以检查布局使利润率在调试菜单中的显示布局保证金。
Also you can check the layout margin enabling in debug menu "show layout margin".
下面的智能手机的规格:
Here the specs for a smartphone:
如果您检查样式 Widget.AppCompat.ActionButton
你会发现了minHeight和规范了minWidth:
If you check the style Widget.AppCompat.ActionButton
you will find the minHeight and minWidth specs:
值:
<style name="Base.Widget.AppCompat.ActionButton" parent="">
<item name="android:minWidth">@dimen/abc_action_button_min_width_material</item>
<item name="android:minHeight">@dimen/abc_action_button_min_height_material</item>
</style>
<dimen name="abc_action_button_min_height_material">48dp</dimen>
<dimen name="abc_action_button_min_width_material">48dp</dimen>
值-V21:
<style name="Widget.Material.ActionButton" parent="Widget.ActionButton">
<item name="minWidth">@dimen/action_button_min_width_material</item>
<item name="minHeight">@dimen/action_button_min_height_material</item>
</style>
<dimen name="action_button_min_width_material">48dp</dimen>
<dimen name="action_button_min_height_material">48dp</dimen>
这篇关于Android的工具栏动作按钮的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!