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 に設定しましたが、Spinner の周りにはまだパディングがあります。余分なパディングを取り除くために何をする必要がありますか?
編集 なぜ私がこれをやろうとしているのか疑問に思う人もいます.
マテリアル デザインの仕様によると、スピナーは左側から 72 dp にする必要があります。
スピナーを適切に配置するために、Google が配置したパディングを中和する必要があります。
編集 2
以下の Chris Bane の回答に従って、contentInsetStart を 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>
これが誰かの役に立てば幸いです。数日間混乱していました。