簡體   English   中英

Android上的某些設備上缺少按鈕

[英]Button is missing on some devices on Android

我面臨着這樣的問題,即缺少不同設備中的按鈕。 在android 5.1和7.0按鈕上,“添加”按鈕可見,但在android 7.1上消失。 但是按鈕“ 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"
    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>

第二個布局帶有“ 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