Extra margin in RelativeLayout

时间:2016-09-01 06:07:48

标签: android android-layout relativelayout android-percent-library margin-left

I'm using Support Android Percentage Library's RelativeLayout AKA android.support.percent.PercentRelativeLayout but it has extra margin on the left edge same as RelaytiveLayout I didn't set any margin or padding but it's still has it, Search a lot and done anything which worked for other people... but NOT SOLVED!

Activity Main Layout codes :

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainCoordinatorLayout"
android:layout_height="match_parent"
android:layout_width="match_parent">
<android.support.design.widget.AppBarLayout
    android:id="@+id/mainAppbarLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <android.support.v7.widget.Toolbar
        android:id="@+id/mainToolbar1"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary">
        <TextView
            android:id="@+id/mainTitle"
            android:text="@string/app_name"
            android:textColor="@android:color/white"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    </android.support.v7.widget.Toolbar>
    <android.support.v7.widget.Toolbar
        android:id="@+id/mainFlexibleSpace"
        android:layout_width="match_parent"
        android:layout_height="180dp">
       <android.support.percent.PercentRelativeLayout
           android:id="@+id/mainPercentRelativeLayout"
           android:layout_width="match_parent"
           android:layout_height="match_parent">
           <TextView
               android:id="@+id/mainEnterLink"
               android:text="@string/str_mainMessageText"
               android:gravity="center"
               android:textColor="@android:color/white"
               android:layout_width="match_parent"
               android:layout_height="wrap_content" />

       </android.support.percent.PercentRelativeLayout>
    </android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>

Any Help? See This Image of my rendered Layout Code

1 个答案:

答案 0 :(得分:1)

Check if it's a issue with the toolbar too (mainFlexibleSpace). If yes then,

Declare the toolBar in java and do this. toolBar.setContentInsetsAbsolute(0,0);