android - Android TextView Gravity BOTTOM 意外行为
问题描述
我当前的 Android 项目要求在 a 中显示多行文本(最多 3 行)TextView
并将文本放置在文本视图的底部。
我的 TextView 定义如下:-
<TextView
android:id="@+id/my_title"
android:layout_width="@dimen/image_width"
android:layout_height="@dimen/image_height"
android:layout_alignTop="@+id/other_title"
android:layout_marginTop="@dimen/span_eight"
android:layout_toEndOf="@+id/dot"
android:maxLines="3"
android:gravity="bottom"
android:padding="2dp"
android:textColor="@android:color/white"
android:textSize="@dimen/text_twelve" />
当要显示的文本为 3 行或更少时,文本将按预期显示。
但是,当它超过 3 行时,文本的开头将被截断。
例如
" Artificial cells, nanomedicine, and biotechnology
"
显示为
"`cine, and biotechnology`"
我需要的是它显示为
"`Artificial cells, nanom`"
我如何达到预期的效果?
解决方案
尝试;
android:gravity="bottom|start"
代替
android:gravity="bottom"
推荐阅读
- javascript - FB.logout() 不适用于角度/离子 3
- php - 如何使用mysql查找多边形线内的位置
- rest - 通过 Postman 的多个 PUT 请求?
- reactive-programming - 如何将 n1ql 查询转换为与 Spring couchbase 反应式存储库以及 @Query 注释一起使用?
- angular - ngx-swiper-wrapper 是否适用于 Angular 7?
- javascript - 使用数据页面列表时 Javascript 不起作用
- c++ - 如果未对输入图像调用 setpixel 方法,则图像分割失败
- java - 如何在 Spring 中使用 Autowired 注解
- ionic-framework - 在后台模式下获取推送通知事件
- c++ - 在 C++ 中读取原始字节数据