jjzjj

android - 应用程序 :layout_marginBottom is not working well with android constraint layout

coder 2023-11-18 原文

下面的 layout_marginBottom 有什么不工作的原因吗? 但是,如果我在第二个 View 上使用 layout_marginTop,它确实可以正常工作

<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ade4ad">
    <TextView
        android:id="@+id/first"
        android:layout_width="90dp"
        android:layout_height="40dp"
        app:layout_marginBottom="10dp"
        android:background="#000"/>
    <TextView
        android:id="@+id/second"
        android:layout_width="90dp"
        android:layout_height="40dp"
        android:background="#fff"
        app:layout_constraintTop_toBottomOf="@+id/first"/>
</android.support.constraint.ConstraintLayout>

最佳答案

为了

android:layout_marginBottom="20dp" 

工作得很好,你应该使用

app:layout_constraintBottom_toBottomOf="parent"

关于android - 应用程序 :layout_marginBottom is not working well with android constraint layout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44931337/

有关android - 应用程序 :layout_marginBottom is not working well with android constraint layout的更多相关文章

随机推荐