Android(安卓)textview 显示不全的问题
16lz
2021-12-04
在界面中,测试反馈有一个界面的textview,有些显示全,但有些只显示了一部分,找来找去,看代码上根本没有什么问题,后来终于在布局文件中找到了问题所在:
<TextView android:id="@+id/profitLoss" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/instrument" android:layout_alignBottom="@+id/instrument" android:layout_alignParentRight="true" android:background="@color/background" android:gravity="center_vertical|right" android:paddingRight="6dip" android:text="-100,000.00" android:textColor="@color/falls" android:textSize="18dp" android:textStyle="bold" />
<TextView android:id="@+id/hedge_mkt" android:layout_width="match_parent" android:layout_height="30dp" <span style="font-size:24px;color:#ff0000;"><strong> android:layout_alignLeft="@+id/profitLoss"</strong></span> android:layout_alignParentBottom="true" android:layout_below="@+id/profitLoss" android:gravity="center_vertical|right" android:paddingRight="6dip" android:textColor="#ffffffff" android:textSize="14sp" />红色的部分表示与上方的textview保持左对齐,这样就会使得当 profitLoss 的长度小于hedge_mkt的长度时,使得hedge_mkt显示不全。
记录一下,以便以后可以查看。
其实textview显示不全,还有的原因是textview初始化了两次,导致第二次赋值的时候已经不是原来的那个。
更多相关文章
- Android:用定时器 timer 刷新界面
- android EditText 全面阐述
- Android(安卓)HTTP实例 发送请求和接收响应
- Android(安卓)SDK下载和更新失败的解决方法
- Android(安卓)EditView属性
- Android系统自带样式(android:theme)
- Android开发EditText属性
- Android(安卓)TextView内容过长加省略号,点击显示全部内容
- Android:EditText 多行显示、属性汇总、族谱