본문 바로가기
Android Dev

[안드로이드]롤리팝 레이아웃 액션바 왼쪽 마진? 패딩? 없애기

by 필팔청춘 2015. 1. 12.




app:contentInsetStart="0dp"

toolbar xml에서 위에 한줄 넣어주면됨... 아래것 안해도됨.


경로 : android-support-v7-appcompat 프로젝트

android-support-v7-appcompat/values/styles_base.xml



변경전

<style name="Base.Widget.AppCompat.Toolbar" parent="android:Widget">

        <item name="titleTextAppearance">@style/TextAppearance.Widget.AppCompat.Toolbar.Title</item>

        <item name="subtitleTextAppearance">@style/TextAppearance.Widget.AppCompat.Toolbar.Subtitle</item>

        <item name="android:minHeight">?attr/actionBarSize</item>

        <item name="titleMargins">4dp</item>

        <item name="maxButtonHeight">56dp</item>

        <item name="collapseIcon">?attr/homeAsUpIndicator</item>

        <item name="collapseContentDescription">@string/abc_toolbar_collapse_description</item>

        <item name="contentInsetStart">16dp</item>

    </style>


변경후

<style name="Base.Widget.AppCompat.Toolbar" parent="android:Widget">

        <item name="titleTextAppearance">@style/TextAppearance.Widget.AppCompat.Toolbar.Title</item>

        <item name="subtitleTextAppearance">@style/TextAppearance.Widget.AppCompat.Toolbar.Subtitle</item>

        <item name="android:minHeight">?attr/actionBarSize</item>

        <item name="titleMargins">4dp</item>

        <item name="maxButtonHeight">56dp</item>

        <item name="collapseIcon">?attr/homeAsUpIndicator</item>

        <item name="collapseContentDescription">@string/abc_toolbar_collapse_description</item>

        <item name="contentInsetStart">0dp</item>

    </style>


참고1 : http://stackoverflow.com/questions/26455027/android-api-21-toolbar-padding

참고2 : http://stackoverflow.com/questions/26433409/android-lollipop-appcompat-actionbar-custom-view-doesnt-take-up-whole-screen-w