【发布时间】:2017-03-24 15:02:38
【问题描述】:
我有一个按钮,即使文本以布局预览为中心,当我运行应用程序时它也会向下滑动。对可能发生的事情有任何想法。
按钮 XML
<Button
android:id="@+id/increment_setup_activity"
android:layout_width="131dp"
android:layout_height="59dp"
android:background="@drawable/settings_panel"
android:text="+"
android:gravity="center"
android:textColor="@color/soft_color"
android:textSize="50sp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout3"
android:layout_marginRight="0dp"
app:layout_constraintRight_toRightOf="@+id/
Android Studio 布局预览
在我的手机上运行
【问题讨论】:
-
尝试减小字体大小,看看是否居中
-
这确实是问题所在,我看到了这篇文章,并且在发布这个问题之前我确实改变了文字,但它仍然没有居中。在再次找到帖子的链接后——这次是你——我决定做一个更极端的减少,它工作正常。我不确定是否应该标记我的问题或将其留在这里。尽管如此,还是非常感谢您并为您点赞。
-
caiomcg 我会添加答案请采纳