当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Toolbar Menu Item appears without margin/padding

问题描述:

The menu items are rendered without any margin/padding.

How can I center the Menu item in the toolbar. I am using the theme Theme.AppCompat.NoActionBar.

menu_main.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

tools:context=".ParkingOffendersActivity">

<item android:id="@+id/action_settings"

android:title="@string/action_settings"

android:orderInCategory="100"

app:showAsAction="collapseActionView" />

</menu>

activity_parking_offenders.xml

<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools"

android:id="@+id/parking_offenders_list"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:context=".ParkingOffendersActivity"

android:orientation="vertical">

<android.support.v7.widget.Toolbar

android:id="@+id/parking_offenders_toolbar"

android:minHeight="20dp"

android:background="@color/color_primary"

android:layout_width="match_parent"

android:layout_height="48dp">

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

</LinearLayout>

分享给朋友:
您可能感兴趣的文章:
随机阅读: