how to remove unnecessary margins from toolbar
I figured it out this is happening because of elevation to AppBarLayout
I set it to zero and its working.
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
app:elevation="0dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
Unwanted Padding/Margin at the beginning of a custom toolbar
You need to add app:contentInsetStart="0dp"
to your Toolbar
if you want it to be flush with the starting (left in LTR) edge. There's also contentInsetEnd
for the other side.
Remove margin from Toolbar
Simply take a look at your container:
<?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">
You got padding all over the place! :
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
Those are the margins. Remove them and you are fine. I suggest you start doing some tutorials.
How to remove toolbar margin-bottom?
You can try adding
android:layout_marginBottom="-8dp"
to the toolbar
.
Android: remove left margin from actionbar's custom layout
If you are adding the Toolbar
via XML, you can simply add XML attributes to remove content insets.
<android.support.v7.widget.Toolbar
xmlns:app="schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primaryColor"
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetRight="0dp"
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp" />
How to remove extra padding on top of toolbar in appbarlayout android
I suggest that try in you Activity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
Related Topics
Touchableopacity Not Working Inside an Absolute Positioned View
Force Override Camera Image on Android
Android Adb Doesn't See Device
How to Avoid the Frame Layout Is Pushed Up When the Soft Keyboard Appears
How to Fix White Screen on App Start Up
Android No on Screen Keybord ( Only Voice )
Limitations on Opening Pdf File in Android
How to Avoid Keyboard Pushing Layout Up on Android React-Native
How to Center the Elements in Constraintlayout
Scrollview Not Scrolling in Android Bottomsheet
Check If Json Object Contains Specific Value
How to Get the Currently Displayed Fragment
How to Figure Out Which Sim Received Sms in Dual Sim Android Device
Onclick() to Change Button Border Color Rather Changing Button Color
Remove Span Tag With Text from String
Adb Is Not Detecting My Android Device on Ubuntu
Can't Create Handler Inside Thread That Has Not Called Looper.Prepare()