简体   繁体   中英

Button is missing on some devices on Android

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>

从两个xml删除app:constraint ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM