0

I have a problem with regard to the layout of Android. I can't show you a layout xml file since I am using the thin client provider Tabris. The image below shows the layout recorded with the layout inspector. What I don't get is why there is such a huge vertical space between the different buttons.

Result Layout Inspector

Of coure I added the layout properties (Frame layout is used) of the layout inspector:

Layout Properties

Maybe some of you have an idea how I can reduce this vertical space between the buttons.

stone
  • 1
  • 2

1 Answers1

0

I suggest you to use LinearLayouts

For Example

 <?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"
   android:layout_gravity="center"
   android:gravity="top|center">
        <TextView
            android:id="@+id/description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/smsVerTit"
            android:textColor="@color/black"
            android:textSize="@dimen/BiggerTextSize"
            android:textStyle="bold"
            android:padding="10dp"/>

        <EditText
            android:id="@+id/smsCode"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="7"
            android:gravity="center"
            android:hint="@string/smsCode"
            android:inputType="number"
            android:layout_marginTop="15dp"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginTop="25dp"
            android:paddingBottom="10dp">
            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
               >
                <Button
                    android:id="@+id/cancelSMS"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/roundedbtn"
                    android:text="@string/cancel"
                    android:textColor="@android:color/white" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                >
                <Button
                    android:id="@+id/confirmSMS"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/roundedbtn"
                    android:text="@string/confirm"
                    android:textColor="@android:color/white" />
            </LinearLayout>
        </LinearLayout>
        <Button
            android:id="@+id/otherMethodSMS"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="?android:attr/selectableItemBackground"
            android:padding="10dp"
            android:text="@string/otherMethods"
            android:textColor="@color/colorPrimaryDark"
            android:layout_marginBottom="13dp"/>
      </LinearLayout>
AhmetAcikalin
  • 328
  • 2
  • 7