0
这是我的menu-main.xml。我怎样才能把我的标志放在Android Action Bar的中心?
代码下方的图片显示了我想将徽标放在我的应用程序中的位置。
<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="com.example.akam.billettogram.MainActivity">**strong text**
<item
android:id="@+id/logo"
app:showAsAction="always"
android:title=""
android:layout_gravity="center"
android:icon="@drawable/logo"/>
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
</menu>
Position that I want to put my logo in.
不要。 Android应用程序在操作栏的中央没有徽标,应该使用操作栏为用户所在的屏幕提供上下文。例如:照片库应该在操作栏中有文字“照片”或“照片库”,而不是徽标。 – CodyEngel
确定感谢您的帮助 – 1987akam
您将不得不定义一个带有文本框(带有中心重力)的新工具栏项目,并将您的活动的主题设置为NoActionBar。我会在一秒内给出答案的例子。 –