It is necessary to make a separator between the buttons, I do not understand how the buttons merge into one background, the line that is visible on the layout is not displayed on the device.

Layout code

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:orientation="horizontal" android:id="@+id/startActivity" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android" > <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.it.irent.irentit.MapsActivity" /> <LinearLayout android:id="@+id/buttonsContainer" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" android:layout_alignParentStart="true"> <Button android:id="@+id/btnReg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_weight="0.66" android:padding="40dp" android:text="@string/register" android:textColor="@color/white" android:background="#044d68" android:onClick="onClickRegister" /> <View android:id="@+id/view_line" android:layout_width="0dp" android:layout_height="50dp" android:layout_alignParentBottom="true" android:layout_alignParentStart="true" android:layout_marginBottom="30dp" android:layout_marginTop="435dp" android:visibility="visible" /> <Button android:id="@+id/btnLog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:padding="40dp" android:text="@string/login" android:layout_weight="1" android:background="#044d68" android:textColor="@color/white" android:onClick="onClickLogin" /> </LinearLayout> </RelativeLayout> 

Here's what it looks like. In length it should be the same.

enter image description here

  • You have line width 0 - YuriySPb
  • @YuriiSPb If I add 1 dp, then just empty space appears between the buttons, attach a photo - Opimand
  • Well ... Apparently, the fact is that you did not specify a color for the line. Point it out via android:background - Yuriy SPb
  • @YuriySPb I adjusted the color, I have to specify the exact position of the line in dp, for my permission I set it up, on another resolution, the line will be in a different place. And the clearance also remains above and below, it should not be. - Opimand

2 answers 2

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/button2" android:layout_width="0dp" android:layout_height="wrap_content" android:background="#044d68" android:layout_weight="1" android:text="Button" /> <View android:layout_width="1dp" android:layout_height="match_parent" android:background="#576ad1" /> <Button android:id="@+id/button" android:layout_width="0dp" android:layout_height="wrap_content" android:background="#044d68" android:layout_weight="1" android:text="Button" /> </LinearLayout> </LinearLayout> 

screen

    Set the background and for the container for the buttons. Plus, you have it in full-height screen - so do not. Adjust the height to wrap_content and remove the monstrously large margins from the line.

    • He set the height of wrap_content, but nothing has changed, the container remains on the whole screen, if you set the background for it, it fills the fragment - Opimand