Home > database >  How to set distance between button and its bound?
How to set distance between button and its bound?

Time:11-12

How do i set the distance shown on the picture below. What attribute do i have to use ?

enter image description here

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@ id/fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <Button
        android:id="@ id/false_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="hello"
        android:textSize="50sp"/>

</FrameLayout>

CodePudding user response:

as per your question you need distance from top and bottom as pointed arrow,

to achieve this you can use android:insetTop and android:insetBottom property,

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@ id/fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <Button
        android:id="@ id/false_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="hello"
        android:textSize="50sp"
        android:insetTop="10dp"
        android:insetBottom="10dp"/>

</FrameLayout>
  • Related