تابستون داره تموم میشه ها، فرصت‌ها محدودن کلی آفر جذاب در کمپین تابستون🔥👇
۰ ثانیه
۰ دقیقه
۰ ساعت
۳ امیر حسین پرندین
نچسبیدن دکمه پایینی
پوریا شفیعی حل شده توسط پوریا شفیعی

سلام وقت به خیر

مشکلی که پیش اومده اینه که دکمه کامل به پایین صفحه چسبیده نمیشه و یه فاصله ریزی به وجود میاد . دلیلش چیه؟

این هم کد مربوط به button :

    <Button
        android:id="@+id/save_info_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:backgroundTint="@color/blue"
        android:text="@string/save_btn"
        android:textColor="@color/white"
        android:textStyle="bold" />

 

سلام وقت بخیر 

احساس میکنم شما margin یا padding برای لیوتتون (که احتمالا میتونه لینیر لیوت باشه ) مشخص کردید. و مشکل از button نیست.

در غیر این صورت کد کامل xml مربوطه رو کپی کنید تا بررسی بشه.

پوریا شفیعی ۲۸ مهر ۱۳۹۹، ۰۷:۵۳

خیر من margin , padding تعریف نکردم

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/gray100"
    tools:context=".ProfileActivity">
    <TextView
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:elevation="500dp"
        android:fontFamily="sans-serif-medium"
        android:gravity="center_vertical"
        android:paddingStart="12dp"
        android:paddingEnd="0dp"
        android:text="@string/app_name"
        android:textColor="@color/black"
        android:textSize="14sp" />
    <Button
        android:id="@+id/save_info_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:backgroundTint="@color/blue"
        android:text="@string/save_btn"
        android:textColor="@color/white"
        android:textStyle="bold" />
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/save_info_btn"
        android:layout_below="@id/toolbar"
        android:id="@+id/scroll">
        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_marginTop="24dp"
                android:contentDescription="@string/profile_photo_text"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/user_photo" />
            <TextView
                android:id="@+id/textView4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:textColor="@color/black"
                android:textSize="14sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/imageView2"
                tools:text="Amir Hossein Parandin" />
            <Button
                android:id="@+id/button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="5dp"
                android:backgroundTint="@color/blue"
                android:text="@string/edith_profile_btn"
                android:textColor="@color/white"
                app:cornerRadius="5dp"
                app:layout_constraintEnd_toStartOf="@+id/button2"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintHorizontal_chainStyle="packed"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/textView4" />
            <Button
                android:id="@+id/button2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="5dp"
                android:text="@string/view_website_btn"
                android:textColor="@color/blue"
                app:cornerRadius="5dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintStart_toEndOf="@+id/button"
                app:layout_constraintTop_toTopOf="@+id/button"
                app:strokeColor="@color/blue"
                app:strokeWidth="1dp" />
            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/guideline"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_constraintGuide_begin="24dp" />
            <TextView
                android:id="@+id/textView6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:fontFamily="sans-serif-medium"
                android:text="@string/skills_text"
                app:layout_constraintStart_toStartOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/button" />
            <TextView
                android:id="@+id/textView7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:fontFamily="sans-serif-medium"
                android:text="@string/city"
                app:layout_constraintStart_toStartOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/checkBox4" />
            <CheckBox
                android:id="@+id/checkBox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:text="@string/skill_android"
                app:layout_constraintStart_toStartOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/textView6" />
            <CheckBox
                android:id="@+id/checkBox3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/skill_uiDesign"
                app:layout_constraintStart_toStartOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/checkBox" />
            <CheckBox
                android:id="@+id/checkBox4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/skill_web"
                app:layout_constraintStart_toStartOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/checkBox3" />
            <RadioButton
                android:id="@+id/radioButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:text="@string/city_eslamAbad"
                app:layout_constraintStart_toStartOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/textView7" />
            <RadioButton
                android:id="@+id/radioButton2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/city_gilan"
                app:layout_constraintStart_toStartOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/radioButton" />
            <RadioButton
                android:id="@+id/radioButton3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/city_kermanshah"
                app:layout_constraintStart_toStartOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/radioButton2" />
        </androidx.constraintlayout.widget.ConstraintLayout>
    </ScrollView>
</RelativeLayout>

 

امیر حسین پرندین ۲۸ مهر ۱۳۹۹، ۰۸:۰۰

سلام

امیر حسین عزیز با attr زیر میتونی چنین margin پیشفرضی رو حذف کنی 

دلیل این باز هم اضافه شدن متریال دیزاین به صورت پیشفرض در اندروید استودیو جدید هست که مارجینی در نظر میگیرد که با insetBotton قابل حذف هست

پس attr زیر رو به Button اضافه کنید 

android:insetBottom="0dp"
بهترین پاسخ
پوریا شفیعی ۲۸ مهر ۱۳۹۹، ۰۹:۲۴