【发布时间】:2017-03-20 18:40:25
【问题描述】:
我在 android xml 中有一个 <textView>。然而,当我向这个 textview 添加文本时,它的宽度会增加。我希望它的宽度保持不变,正好是屏幕宽度的一半。我该怎么做?
<TextView
android:id="@+id/decrypted"
android:layout_height="100dp"
android:layout_weight="0.5"
android:background="@drawable/back"
android:text=""/> <!--I want this to change without the entire width changing.-->
【问题讨论】:
-
添加 android:layout_width="0dp"
-
这似乎奏效了!谢谢。