Я создал пользовательскую панель инструментов для своего приложения для Android от руководства Google, но даже подумал, что мой код такой же, как и в учебнике, у меня есть дополнительный запас на моей панели инструментов.Удалить margin из панели инструментов
Вот мой layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.gruber.jakub.personalscheduler.MainActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:paddingLeft="0dp"
android:elevation="4dp"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="30sp"
android:layout_centerHorizontal="true"
android:layout_above="@+id/button"
android:layout_marginBottom="60dp"/>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/button1"
android:layout_centerInParent="true" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@android:drawable/ic_menu_today"
android:elevation="4dp" />
</RelativeLayout>
и мой styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<!--Action bar style-->
<item name="android:actionBarStyle">@style/ActionBarTheme</item>
</style>
<style name="ActionBarTheme" parent="Widget.AppCompat.ActionBar">
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
</style>
Это только смотреть как я хочу, если я изменю свойство android:padding...
в своем layout.xml, но это не то, что я хотел бы сделать, потому что мне пришлось бы добавлять дополнительные свойства ко всем остальным элементам.
YOu добавляет дополнение в свой относительный макет. Удалите это дополнение, и он будет работать нормально –