如何修复文本溢出TextView与填充android:ellipsize =“marquee”

如何修复文本溢出TextView与填充android:ellipsize =“marquee”,第1张

概述在某些 Android设备上(带有 Android L和M的LG Google Nexus 5),带有android:ellipsize =“marquee”的文本视图和填充会导致文本溢出textview.它发生在右侧但不在TextView的左侧,而填充应用于左侧和右侧. 三星Galaxy S3和S6分别不会出现在Android K和L上. <TextViewandroid:layout_wid 在某些 Android设备上(带有 Android L和M的LG Google Nexus 5),带有androID:ellipsize =“marquee”的文本视图和填充会导致文本溢出textvIEw.它发生在右侧但不在TextVIEw的左侧,而填充应用于左侧和右侧.

三星galaxy S3和S6分别不会出现在AndroID K和L上.

<TextVIEwandroID:layout_wIDth="match_parent"androID:layout_height="wrap_content"androID:layout_marginBottom="1dp"androID:paddingtop="2dp"androID:paddingBottom="2dp"androID:paddingleft="4dp"androID:paddingRight="4dp"androID:singleline="true"androID:ellipsize="marquee"androID:marqueeRepeatlimit="marquee_forever"androID:scrollHorizontally="true"androID:freezesText="true"androID:Alpha="0.85"androID:background="@color/by433_gray_darker"androID:textcolor="@color/white"androID:textSize="11sp" />

我该怎么做才能解决或解决这个问题?

解决方法 您的问题是AndroID开源项目中AndroID和 already reported and assigned的错误:

您的解决方法可能如下所示:

<FrameLayout androID:layout_wIDth="match_parent"             androID:layout_height="wrap_content"             androID:paddingtop="2dp"             androID:paddingBottom="2dp"             androID:paddingleft="4dp"             androID:paddingRight="4dp"             androID:layout_marginBottom="1dp"             androID:background="@color/by433_gray_darker">    <TextVIEw        androID:ID="@+ID/textID"        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:singleline="true"        androID:ellipsize="marquee"        androID:marqueeRepeatlimit="marquee_forever"        androID:scrollHorizontally="true"        androID:freezesText="false"        androID:Alpha="0.85"        androID:text="super nice text text text text text text text text text text text text text text text text text"        androID:textcolor="@color/white"        androID:textSize="11sp" /></FrameLayout>

因此,我们的想法是拥有一个带有填充,边距和背景的包装容器. (如果您只有几个这样的视图,那么性能开销应该不大)

原始的错误答案(虽然有两个TextVIEws)
问题可能是由于TextVIEw上有如此多的属性组合.以下是一些建议:

>首先尝试逐个删除属性,检查结果
>您可以尝试在容器上指定填充而不是文本视图
>从您的布局看起来您可以尝试这样的事情
而不是文本视图上的“match_parent”:

<linearLayout androID:orIEntation="horizontal" ...>    <TextVIEw androID:layout_wIDth="0dp" androID:layout_weight="1" ... />    <TextVIEw androID:layout_wIDth="0dp" androID:layout_weight="1" ... /></linearLayout>
总结

以上是内存溢出为你收集整理的如何修复文本溢出TextView与填充android:ellipsize =“marquee”全部内容,希望文章能够帮你解决如何修复文本溢出TextView与填充android:ellipsize =“marquee”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1135701.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存