我需要操作栏中的标签与自定义标题栏的android [英] I need action bar tabs with custom title bar android

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

问题描述

我要的是行动吧卡口与Android的自定义标题栏。我用这code

I need action bar tabs with custom title bar in android. I am using this code

actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(R.layout.customtitle);

,但它不能正常工作。当前选项卡显示低于称号。我需要标题下方显示标签。谁能帮我?

but it isn't working properly. Currently tabs are showing below title. I need title to show below tabs. Can anyone help me?

推荐答案

根据 http://developer.android.com/reference/android/app/ActionBar.html

setCustomView(View view, ActionBar.LayoutParams layoutParams)

这个功能采取第二个参数ActionBar.LayoutParams参数。
所以,你可以做到这一点。

this function take ActionBar.LayoutParams parameter in second parameter. So you can do it

final View actionCustomView = getLayoutInflater().inflate(
            R.layout.custom_action_bar, null);
actionBar.setCustomView(actionCustomView, new ActionBar.LayoutParams(
            android.view.ViewGroup.LayoutParams.MATCH_PARENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT));

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

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