app:layout_marginBottom在android约束布局下无法正常工作 [英] app:layout_marginBottom is not working well with android constraint layout
本文介绍了app:layout_marginBottom在android约束布局下无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有任何原因导致以下layout_marginBottom无法正常工作?但是,如果我在第二个视图上使用layout_marginTop,则效果很好
Is there any reason why the following layout_marginBottom is not working? However, if I use layout_marginTop on the second view it does work well
<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"
这篇关于app:layout_marginBottom在android约束布局下无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文