Android 平板电脑上的工具栏菜单溢出图标边距问题。

3
当在智能手机上运行时,工具栏文本视图是居中的,但在平板电脑上运行时,溢出图标会产生额外的填充,如何摆脱它们?

enter image description here enter image description here
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <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"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@android:color/white"
        android:fitsSystemWindows="true"
        app:popupTheme="@style/AppTheme.PopupOverlay">

        <TextView
            android:id="@+id/centerTitleToolbarTextView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:maxLines="1"
            android:textColor="@color/color_toolbar"
            android:textSize="@dimen/titleToolbar" />

    </android.support.v7.widget.Toolbar>

    <View
        android:id="@+id/shadow_view"
        android:layout_width="match_parent"
        android:visibility="gone"
        android:layout_height="4dp"
        android:background="@drawable/toolbar_shadow" />

</LinearLayout>
1个回答

2

尝试为工具栏添加android:padding="0dp",这对我有用。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接