gpt4 book ai didi

android - TextView 轻微移动

转载 作者:行者123 更新时间:2023-11-29 21:17:01 25 4
gpt4 key购买 nike

我有 2 个 TextView。第一个是居中,第二个与父元素的最右边缘对齐。

当我更新 Second TextView 中的文本时,它会使 first TextView 稍微向左移动,然后返回到其在中心的原始位置。

我不知道发生了什么

这是我的 .xml 文件的相关部分

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/MC_title"
android:layout_width="wrap_content"
android:layout_height="160dp"
android:layout_centerInParent="true"/>

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="16dp"
android:layout_marginTop="22dp" />
</RelativeLayout>

最佳答案

我认为可能 android:layout_centerHorizo​​ntal="true" 而不是 android:layout_centerInParent="true" 会解决您的问题。

关于android - TextView 轻微移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21165345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com