Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] android – How to fix buttons from the bottom in a layout?

Posted on November 14, 2022

Solution 1 :

Use this code android:layout_gravity=”bottom”
hope it will work for you

  <Button
        android_id="@+id/about_button_terms_and_conditions"
        android_textAllCaps="false"
        android_layout_width="250sp"
        android_layout_height="wrap_content"
        style="@style/Widget.AppCompat.Button"
        android_layout_gravity="bottom"
        android_text="@string/about_terms_and_conditions"
        android_layout_marginBottom="30dp"/>

Solution 2 :

use this Tag

android:layout_gravity="bottom"

Problem :

I have the following layout:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns_android="http://schemas.android.com/apk/res/android"
    xmlns_app="http://schemas.android.com/apk/res-auto"
    android_layout_width="match_parent"
    android_layout_height="match_parent">

    <LinearLayout
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_orientation="vertical"
        app_layout_behavior="@string/appbar_scrolling_view_behavior"
        android_layout_marginTop="30dp">

        <TextView
            android_id="@+id/about_header"
            android_layout_gravity="center_horizontal"
            android_layout_width="wrap_content"
            android_layout_height="wrap_content"
            android_text="@string/app_name"
            android_textColor="@color/primaryColor"
            android_textSize="60sp" />

        <TextView
            android_id="@+id/about_version"
            android_layout_gravity="center_horizontal"
            android_layout_width="wrap_content"
            android_layout_height="wrap_content"
            android_textColor="@color/primaryColor"
            android_textSize="25sp" />

        <ImageView
            android_id="@+id/about_image"
            android_layout_marginTop="10dp"
            android_layout_width="match_parent"
            android_layout_height="100dp"
            app_srcCompat="@drawable/environment" />

        <Button
            android_id="@+id/about_button_privacy_policy"
            android_textAllCaps="false"
            android_layout_width="250sp"
            android_layout_height="wrap_content"
            style="@style/Widget.AppCompat.Button"
            android_layout_gravity="center"
            android_text="@string/about_privacy_policy" />

        <Button
            android_id="@+id/about_button_terms_and_conditions"
            android_textAllCaps="false"
            android_layout_width="250sp"
            android_layout_height="wrap_content"
            style="@style/Widget.AppCompat.Button"
            android_layout_gravity="center"
            android_text="@string/about_terms_and_conditions"
            android_layout_marginBottom="30dp"/>

    </LinearLayout>

</ScrollView>

I want to have a big space between the image and the two buttons on the bottom. Something like:

[title]
[title]
[image]



[Button]
[Button]

I used marginTop but in some devices you can’t see the bottom. I would like to use something more robust. I’m using API 16. Is there a way to fix the two buttons to be for example “15dp” from the bottom?

Comments

Comment posted by Beko

Try

Comment posted by Mervin Hemaraju

marginTop is the best way to go in my opinion and it should work in all devices. If it doesn’t work in “some devices” then it should be another issue which you need to test by checking the layout inspector on this specific device.

Comment posted by ConstraintLayout

Why don’t you use a

READ  [ANSWERED] android - How can we play video in Alert Dialogue Flutter
Powered by Inline Related Posts

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress