操作栏自定义视图 [英] Action bar custom view

查看:112
本文介绍了操作栏自定义视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要声明一个自定义视图,但我也希望家乡的标志高达图标出现在左侧,其默认功能。我如何能实现同时使用?

I want to declare a custom view, BUT I also want the home logo with up icon to appear on the left with its default functionality. How can I achieve to use both?

推荐答案

最好的办法是使用XML风格:

Best way is to use XML styles:

<style name="Theme.Main" parent="android:Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/Widget.ActionBar</item>
</style>

<style name="Widget.ActionBar" parent="android:Widget.Holo.Light.ActionBar">
    <item name="android:displayOptions">showHome|useLogo|showCustom</item>
    <item name="android:customNavigationLayout">@layout/custom</item>
</style>

然后,只需设置这个主题,无论是在的Andr​​oidManifest.xml

这篇关于操作栏自定义视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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