
在应用程序的一些活动中,我需要工具栏不显示应用程序标题,我不知道如何,但它默认显示.在这些活动中,我在工具栏的右侧有一个文本视图,就像一个按钮,我已经实现了traex的RippleEffect.
所以,基本上我的问题是,如何从工具栏隐藏应用程序的标题?因为即使我做:
toolbar.setTitle(""); 要么
toolbar.setTitle(null);
它继续出现.
这是我的代码:
自定义工具栏xml [toolbar_intro.xml]:
<androID.support.v7.Widget.Toolbar xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:local="http://schemas.androID.com/apk/res-auto" xmlns:ripple="http://schemas.androID.com/apk/res-auto" xmlns:app="http://schemas.androID.com/tools" androID:ID="@+ID/toolbar" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:minHeight="?attr/actionbarSize" androID:background="?attr/colorPrimary" androID:elevation="4dp" local:theme="@style/themeOverlay.AppCompat.Dark.Actionbar" local:popuptheme="@style/themeOverlay.AppCompat.light"> <com.andexert.library.RippleVIEw androID:ID="@+ID/more" androID:layout_wIDth="wrap_content" androID:layout_height="fill_parent" androID:layout_gravity="right" androID:layout_marginRight="40dp" ripple:rv_centered="false" app:rv_rippleduration="1"> <TextVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:ID="@+ID/toolbar_text" androID:textcolor="@color/White" androID:textStyle="bold" androID:textSize="25sp" androID:text="Next"/> </com.andexert.library.RippleVIEw></androID.support.v7.Widget.Toolbar>
这是我如何在布局中包含工具栏:
<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:orIEntation="vertical"> <include androID:ID="@+ID/toolbar" layout="@layout/toolbar_intro" /> <relativeLayout androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content"> <ImageVIEw ... </relativeLayout></linearLayout>
这是活动:
@OverrIDeprotected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.intro_wellcome); toolbar= (Toolbar) findVIEwByID(R.ID.toolbar); if (toolbar != null) { setSupportActionbar(toolbar); toolbar.setTitle(""); } TextVIEw toolbar_text = (TextVIEw) toolbar.findVIEwByID(R.ID.toolbar_text); toolbar_text.setText(R.string.next); ...} 此外,这是我实现的风格:
<style name="Materialtheme.Base" parent="theme.AppCompat.light.NoActionbar">解决方法 使用
getSupportActionbar().setdisplayShowTitleEnabled(false);总结
以上是内存溢出为你收集整理的android – 在support.v7.widget.toolbar上隐藏应用程序标题全部内容,希望文章能够帮你解决android – 在support.v7.widget.toolbar上隐藏应用程序标题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)