菜单资源项目职位名称,以图标的左 [英] Menu Resource Item Position Title to Left of Icon

查看:162
本文介绍了菜单资源项目职位名称,以图标的左的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法为一个菜单项的标题文本定位到的图标,而不是在动作条右边的左边?因此,在

Is there a way to position the title text for a menu item to the left of the icon rather than to the right in an ActionBar? So in:

<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item
    android:id="@+id/forward"
    android:title="Begin"
    android:icon="@drawable/ForwardArrow"
    android:showAsAction="always"></item>
</menu>

这样看来开始 - >而不是 - >开始

It would appear "Begin ->" instead of "-> Begin"

推荐答案

虽然你可以这样定义东西的android:在一个主题actionButtonStyle 并应用到你的活动,我我不知道,你可以用它来回身影响图像与文本的定位。

While you can define things like android:actionButtonStyle in a theme and apply that to your activity, I am not aware that you can use that to turn around and affect the positioning of the image versus the text.

不过,您可以使用的android:actionLayout &LT;项目&GT; 元素来取代股票操作按钮与其他人自己设计的东西。如果推杆周围的Andr​​oid源并找到这些操作按钮来的,我怀疑你会发现,他们使用的是复合绘制的东西把图像风格按钮对象旁边的文字说明。克隆了与开关一侧的图像,然后使用你的 actionLayout ,宜工,至少在理论上。

However, you can use android:actionLayout in your <item> element to replace the stock action button with something else of your own design. If you putter around the Android source and find where these action buttons come from, I suspect that you will find that they are styled Button objects using the compound drawable stuff to put an image alongside the text caption. Cloning that and switching the side for the image, then using that for your actionLayout, should work, at least in theory.

这篇关于菜单资源项目职位名称,以图标的左的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆