i use this code to create menu for action bar in xamarin. but text is being shown, not the icon. i want icons only to be appear. Here is what i try for creating the menu.
我使用此代码为xamarin中的操作栏创建菜单。但正在显示文字,而不是图标。我只希望图标出现。这是我尝试创建菜单。
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/android-auto">
<item android:id="@+id/action_reply"
android:icon="@drawable/ic_rotate"
android:title="Reply"
android:showAsAction="always" />
<item android:id="@+id/action_undo"
android:icon="@drawable/ic_dashboard"
android:title="Undo"
android:showAsAction="never" />
</menu>
Here is the action bar code
这是动作条形码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FEFEFE">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:layout_alignParentTop="true" />
can anyone suggest some improvements?
有人可以建议一些改进吗?
1 个解决方案
#1
0
You are using the Android Support V7 Toolbar, you need to correct your menu to use xmlns:local="http://schemas.android.com/apk/res/android-auto"
instead of xmlns:app="http://schemas.android.com/apk/res/android-auto"
then change android:showAsAction="always"
to local:showAsAction="always"
您正在使用Android支持V7工具栏,您需要更正您的菜单以使用xmlns:local =“http://schemas.android.com/apk/res/android-auto”而不是xmlns:app =“http:/ /schemas.android.com/apk/res/android-auto“然后将android:showAsAction =”always“更改为local:showAsAction =”always“
#1
0
You are using the Android Support V7 Toolbar, you need to correct your menu to use xmlns:local="http://schemas.android.com/apk/res/android-auto"
instead of xmlns:app="http://schemas.android.com/apk/res/android-auto"
then change android:showAsAction="always"
to local:showAsAction="always"
您正在使用Android支持V7工具栏,您需要更正您的菜单以使用xmlns:local =“http://schemas.android.com/apk/res/android-auto”而不是xmlns:app =“http:/ /schemas.android.com/apk/res/android-auto“然后将android:showAsAction =”always“更改为local:showAsAction =”always“