如何使用Android SDK API 21版(支持库)消除新工具栏中的额外填充?
我说的是这张照片上的红色箭头:
以下是我使用的代码:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:padding="0dp"
android:layout_margin="0dp">
<RelativeLayout
android:id="@+id/action_bar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:padding="0dp"
android:background="#000000">
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</Toolbar>
正如你所见,我已经将所有相关的填充设置为0,但微调器周围仍然有填充.我做错了什么,或者我需要做什么来go 除多余的填充物?
Edit
根据material 设计规范,旋转器从左侧开始应为72dp
我需要中和谷歌放在那里的填充物,以便正确放置微调器:
Edit 2
根据Chris Bane下面的回答,我将ContentInsertStart设置为0.对于支持库,您需要使用应用程序名称空间:
<android.support.v4.widget.DrawerLayout
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.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="@dimen/action_bar_height"
android:background="?attr/colorPrimary"
android:contentInsetStart="0dp"
android:contentInsetLeft="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v4.widget.DrawerLayout>
我希望这能帮助别人,这让我困惑了好几天.