如上图所示,蓝色边框所选中的控件是一个textview,在第一行到“负一层”明明就已经结束了,但后面却跟了几个明显的空格(连同下面几行都跟着空格),导致整个控件偏大,压缩了右边的控件,这是怎么回事呢?看上去有点像word那种“为了不让一个单词从中间被换行而宁愿让该行少放一个单词并且留白右侧”的做法。但我这里用的都是中文,为什么会有这种现象呢?
另外还有个问题,为什么我3个控件的layout_weight都设置为1了,可他们的大小却明显看起来不一样呢?
代码如下:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下单日期:2019年11月30日\n\n预计到货日期:\n2019年12月06日"
android:layout_weight="1"
android:singleLine="false"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="松山湖深城投地下室负一层(4191130-00247)\n\n******************************\n父项目:松山湖深城投\n(0190831-00047)"
android:layout_weight="1"
android:singleLine="false"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="当前状态:已出货"
android:layout_weight="1"
android:singleLine="false"
/>
</LinearLayout>