Я использую пользовательскую панель инструментов, которая построена таким образом:Android опции меню верхнего уровня и нижнего поля
<android.support.v7.widget.Toolbar
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="match_parent"
android:paddingLeft="0dp"
android:contentInsetStart="0dp"
android:contentInsetLeft="0dp"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/deepDarkVioletToolbar">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/defaultMargin"
android:layout_marginTop="16dp"
android:background="@drawable/logo" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
его использование:
<RelativeLayout
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"
tools:context=".views.activities.MainActivity">
<include
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
layout="@layout/default_toolbar" />
<!-- other views go here -->
</RelativeLayout>
Я пытаюсь добавить меню опций к моему применение, поэтому для того, чтобы сделать это, я добавил этот метод к моей деятельности:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
((Toolbar)findViewById(R.id.toolbar)).inflateMenu(R.menu.main_menu);
return true;
}
И мои main_menu
расположения:
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/appMenu"
android:title="menu"
android:visible="true"
app:showAsAction="always"
app:actionViewClass="android.Widget.ImageButton"
android:icon="@drawable/menu_bg"
android:enabled="true"
android:checkable="false">
<item android:title="Your orders" />
<item android:title="Log out" />
</item>
</menu>
Проблема в том, что в меню параметров есть некоторые поля (paddings?) - сверху и снизу. Вы можете посмотреть на этом скриншоте:
У меня есть три вопроса (первый из которых является наиболее важным):
- Как избавиться от этих краях?
android:icon
по пункту меню не имеет никакого эффекта, так как я могу разместить там значок? Если это невозможно, то:- Как изменить цвет этих трех точек?