在操作栏中调整Applicaion名栏中、操作、Applicaion

2023-09-12 03:21:22 作者:伸手不及放手为空

在我的应用程序已经在操作栏4个按钮。我加了安卓showAsAction =永远| withText每个项目在XML文件中,以强制显示全部4的图标。 我测试的应用程序在4.0屏幕,并在竖看我看到左边的应用程序图标,应用程序名称被切断,然后我看到4个图标/按钮,例如,应用程序名称为流行,而所有4个图标操作栏中,我看到潘...

In my application I have 4 buttons in the Action Bar. I added android:showAsAction="always|withText" to each item in the xml file in order to force show all 4 of the icons. I am testing the app on a 4.0" screen, and in vertical view I see the application icon on the left, the app name is cut, and then i see the 4 icons/buttons. For example, the app name is Pandemic, and with all 4 icons in the action bar, i see Pan...

我怎样才能让应用程序的名称文本resiz动态的应用程序图标,并在操作栏最左侧的图标之间的填充?

How can I have the application name text resiz to dynamically to fill between the app icon and the left most icon on the action bar?

感谢您。

推荐答案

根据这个的 http://developer.android.com/design/patterns/actionbar.html (搜索多少行动将适合在主操作栏?) 你应该表现出,​​但在4显示器2的动作。 当然,你可以表现出更多的行动,但后来你遇到了你所遇到的问题。此外,这些建议是设计指南,这是有道理的跟着他们提供良好的用户体验。有四个按钮旁边的标题,使操作栏太拥挤了IMO。

According to this http://developer.android.com/design/patterns/actionbar.html (search for "How many actions will fit in the main action bar?") you should show but 2 actions on a 4" display. Of course you can show more actions but then you run into the problem you encountered. Also these recommendations are design guidelines and it makes sense to follow them to offer a good user experience. Having four buttons next to the title makes the action bar too crowded IMO.

我看到几个选项,你可以追求:

I see a couple of options you can pursue:

使用安卓showAsAction =ifRoom | withText,而不是永远| withText 使用一个分裂操作栏,以允许机器人,以显示在屏幕上的底部的操作,如果没有足够的空间在上方。这将仍然显示在平板电脑上的大小的设备上的操作。另请参见 http://developer.android.com/guide/topics/ui /actionbar.html#SplitBar

使用您的标题自定义布局,使标题更小。我不建议,因为这将违背设计原则至少是含蓄。如果你仍然想下去,你需要使用创建自己的布局为标题的路径 Use android:showAsAction="ifRoom|withText" instead of "always|withText" Use a split action bar to allow Android to show the actions at the bottom on the screen if there isn't enough space at the top. It would still show the actions at the top on tablet sized devices. See also http://developer.android.com/guide/topics/ui/actionbar.html#SplitBar

Use a custom layout for your title to make the title smaller. I wouldn't recommend this because it would violate the design guidelines at least implicitly. If you still want to go down that path you need to create your own layout for the title using

actionBar.setCustomView(newTitleBar,新ActionBar.LayoutParams(Gravity.LEFT))

actionBar.setCustomView(newTitleBar, new ActionBar.LayoutParams(Gravity.LEFT))

要开始使用自定义布局只是复制一个Android正在从你的SDK文件夹中使用。

To start with a custom layout just copy the one Android is using from your SDK folder.