10
Android API 21ツールバーのパディング
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"> …