I have a layout toolbar, there are certain elements, when adding a button, these elements move down.
I need to fasten this button to the rightmost side of the bar (in the markup, this is the android button: id = "@ + id / light_button). How to do it, without shifting the elements
Markup Code:
<RelativeLayout android:id="@+id/autocode_layout_mainToolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:paddingRight="24dp" android:src="@drawable/logo" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> <RelativeLayout android:id="@+id/title_layout_mainToolbar" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/cancel_button_toolbar" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:visibility="gone" android:fontFamily="sans-serif-medium" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:text="@string/cancel" /> <TextView android:id="@+id/title_textView_mainToolbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@android:color/black" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_centerVertical="true" /> <LinearLayout android:id="@+id/autoExpert_layout_mainToolbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:visibility="gone" android:paddingRight="24dp" android:layout_toLeftOf="@+id/done_button_toolbar" android:layout_toStartOf="@+id/done_button_toolbar" android:orientation="horizontal" android:layout_below="@id/imageView2"> <TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:textColor="@color/text_in_list" android:fontFamily="sans-serif-light" android:textSize="22sp" android:text="@string/auto"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/text_in_list" android:fontFamily="sans-serif-medium" android:textSize="22sp" android:text="@string/expert"/> <ImageView android:layout_width="17dp" android:layout_height="17dp" android:src="@drawable/check" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/layout" android:layout_toEndOf="@+id/layout" /> <ImageButton android:id="@+id/light_button" android:layout_width="50dp" android:src="@drawable/lightning" android:background="@color/white" android:layout_height="50dp" /> </LinearLayout> <Button android:id="@+id/done_button_toolbar" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:textStyle="bold" android:fontFamily="sans-serif-medium" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:text="@string/done" /> </RelativeLayout>