简体   繁体   English

Android上的某些设备上缺少按钮

[英]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. 在android 5.1和7.0按钮上,“添加”按钮可见,但在android 7.1上消失。 But the button "all_lenta" is visible on all devices. 但是按钮“ all_lenta”在所有设备上可见。 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: 第二个布局带有“ all_lenta”按钮:

<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 ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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