标题下工具栏中的自定义视图

时间:2015-11-10 15:53:02

标签: android android-layout toolbar android-custom-view

我知道(并使用它)如何将自定义视图添加到工具栏(作为ActionBar)。但是我现在的要求是在标题下面显示自定义视图 。有没有办法实现这一点,而无需在自定义视图中包含标题?我更喜欢将标题管理留给工具栏本身。

2 个答案:

答案 0 :(得分:-1)

我理解错了!

你可以尝试

View custom  = getLayoutInflater().inflate(R.layout.custom,toolbar,true);

custom.setLayoutParams();

我要去睡觉了。

答案 1 :(得分:-1)

你也可以使用appbar,

<AppBarLayout>
  <Toolbar/>
  <CustonView/>
<AppBarLayout/>

查看官方文档 http://developer.android.com/reference/android/support/design/widget/AppBarLayout.html