Home » Android » Button is missing on some devices on Android

Button is missing on some devices on Android

Posted by: admin November 1, 2017 Leave a comment

Questions:

I was faced with such a problem as missing of the buttons in different devices.
On android 5.1 and 7.0 button “add” is visible, but on android 7.1 it dissapears. But the button “all_lenta” is visible on all devices.
I can’t understand, why it happens…

The first layout with “add” button:

<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/light_blue"
    android:orientation="vertical"
    android:clickable="true"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="1.0"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.0">

    <Button
        android:id="@+id/add_post"
        android:layout_width="150dp"
        android:layout_height="40dp"
        android:background="@drawable/add"
        android:layout_below="@id/header"
        android:layout_marginTop="23dp"
        android:layout_marginLeft="23dp"/>
</RelativeLayout>

The second layout with “all_lenta” button:

<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"
    tools:context="com.example.delya.achieverdel.ProfileActivity"
    android:background="@color/light_blue"
    android:orientation="vertical"
    android:clickable="true"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="1.0"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.0">

    <Button
        android:id="@+id/all_lenta"
        android:layout_width="80dp"
        android:layout_height="40dp"
        android:background="@drawable/all_lenta"
        android:layout_below="@id/header"
        android:layout_marginTop="23dp"
        android:layout_marginLeft="23dp"/>

</RelativeLayout>
Answers:

Delete app:constraint… from both of xmls