
我想创建一个Android应用程序,它有3个滑动选项卡面板,每个都有5个按钮(保存,新建,删除,退出..).@H_301_1@
我想要的完全如下:
我创建了滑动选项卡面板.对于5个按钮,我添加了分割 *** 作栏.但它可以像普通的分割 *** 作栏一样工作.我的AndroIDManifest.xml是:@H_301_1@
@H_301_1@
<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"package="com.belsoft.myapplication"><application androID:allowBackup="true" androID:icon="@mipmap/ic_launcher" androID:label="@string/app_name" androID:supportsRtl="true" androID:uiOptions="splitactionbarWhenNarrow" androID:theme="@style/Apptheme"> <activity androID:name=".MainActivity" androID:label="@string/app_name" androID:theme="@style/Apptheme.NoActionbar"> <intent-filter> <action androID:name="androID.intent.action.MAIN" /> <category androID:name="androID.intent.category.LAUNCHER" /> </intent-filter> </activity></application></manifest>我哪里错了?@H_301_1@
解决方法:@H_301_1@
要实现splitactionbar:@H_301_1@
只需将androID:uiOptions =“splitactionbarWhenNarrow”添加到AndroIDManifest.xml中的活动标签,就像这样……@H_301_1@
`<activity androID:name=".MainActivity" androID:uiOptions="splitactionbarWhenNarrow">`<br>您可以阅读更多here和here@H_301_1@
@H_301_1@
NOTE: It is available ONLY for handset devices with a screen wIDth
of400dp.@H_301_1@
要创建自定义底部工具栏:@H_301_1@
如果要为所有设备设置它,请在此处查看我的答案(查找以创建自定义底部工具栏开头的帖子):@H_301_1@
@H_301_1@
Creating custom bottom toolbarI’ve already created a simple app which should demonstrate you how to
begin@H_301_1@@H_301_1@ @H_301_1@Creating a custom VIEwGroup
Here’s my
activity_main.xmllayout file:@H_301_1@06001@H_301_1@
As you can see my parent
VIEwGroupisrelativeLayout, which simply
allows me to create a vIEw at the bottom of screen. @H_301_1@Notice that I set layout padding to zero (I think: setting layout
margin to zero here is not necessary, the same effect). If you’d
change it, the toolbar won’t use full wIDth and it won’t stick with
bottom of the screen.@H_301_1@Then I added a linear Layout with hardcoded height which is:@H_301_1@
06002@H_301_1@
I wanted it, that my bottom toolbar would take full available wIDth so
I set it asmatch_parent.@H_301_1@Next, I added some
ImagebuttonvIEws with images from AndroID
library.@H_301_1@There you have two possibilitIEs:@H_301_1@
if you really want to have a toolbar like in above example just remove in every
ImagebuttonvIEw this line:@H_301_1@06003@H_301_1@
After removing weights and some buttons you would get a vIEw pretty
similar to expected:@H_301_1@@H_301_1@@H_301_1@if you want to take the full wIDth and make every button with the same size use in your project
weightas in this mine example.Now let’s go to my AndroIDManifest.xml@H_301_1@
06004@H_301_1@
In that file I’d added as you can see only one additional line:@H_301_1@
06005@H_301_1@
to make sure that device keyboard won’t hIDe my custom bottom toolbar.@H_301_1@
From: 07002@H_301_1@
如果您有任何疑问,请随意提问.@H_301_1@
希望它有所帮助@H_301_1@ 总结
以上是内存溢出为你收集整理的android – 如何启用Split Action Bar?全部内容,希望文章能够帮你解决android – 如何启用Split Action Bar?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)