删除汉堡包和标题之间的填充

问题描述:

我想删除操作栏中汉堡包&之间的左填充而不必使用工具栏。我尝试过工具栏,但遇到了我觉得有缺点的限制。 我是Android编程的新手,并希望能够使用默认的ActionBar来干净利落地解决这个问题。删除汉堡包和标题之间的填充

enter image description here

试试下面的工具栏

app:contentInsetLeft="0dp" 
app:contentInsetStart="0dp" 
app:contentInsetStartWithNavigation="0dp" 

现在设置你toolbar这样

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" 
     app:contentInsetLeft="0dp" 
     app:contentInsetStart="0dp" 
     app:contentInsetStartWithNavigation="0dp" /> 

</android.support.design.widget.AppBarLayout> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    // add here all your controlls 
</LinearLayout> 

</android.support.design.widget.CoordinatorLayout> 

现在设置工具栏上的活动这样

财产这种使用
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
    setSupportActionBar(toolbar); 

问我的情况下,任何的查询

+0

感谢您的答复。 Kinly阐述了以下应用:titleTextAppearance =“@ style/Toolbar.TitleText” app:popupTheme =“@ style/AppTheme.PopupOverlay” – jmsiox

+0

@jmsiox没有让你..? –

+0

我坚持为工具栏添加样式,因为我的文本在更改为工具栏后现在不可见。 – jmsiox