Skip to content Skip to sidebar Skip to footer

Actionbar Will Not Align Correctly (RelativeLayout)

I am trying to design my actionbar to have the textview in the dead center of the actionbar, and an imageview on the far right of the actionbar, but I just cannot get the image to

Solution 1:

You can use toolbar instead of action bar.

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:minHeight="?attr/actionBarSize"
    android:background="#03a9f4"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    >
    <TextView
        android:layout_gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="48dp"
        android:gravity="center"
        android:textColor="#ffffff"
        android:textSize="14sp"
        android:text="@string/profile_setup"
        android:id="@+id/title"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:text="@string/join"
        android:paddingRight="24dp"
        android:textColor="#ffffff"
        android:textSize="14sp"
        android:id="@+id/actionButton"
        />
</android.support.v7.widget.Toolbar>

Post a Comment for "Actionbar Will Not Align Correctly (RelativeLayout)"