- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个 parent <div>
有多个 child span
秒。父 div 的宽度是固定的,但子 span 的宽度可以是动态的。我试过的方式,文本溢出:省略号似乎对 child 不起作用。
<div class="parent">
<span class="child1"> Content 1</span>
<span class="child2"> Content 2</span>
<span class="child3"> Content 3</span>
</div>
.parent {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: 200px;
display: inline-block;
}
span {
display: inline-block;
}
JsFiddle .
最佳答案
text-overflow
不是 inherited
属性(property)。这意味着您分配给它的值仅适用于父元素 (.parent
) 但不适用于其子元素 (span
)。
要解决您的问题,只需将该属性向下移动到子项即可。例如(取决于您的上下文)您可以这样编码:
.parent {
border: 1px solid red;
}
span {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
width: 50px;
border: 1px solid blue;
overflow: hidden;
}
关于html - 文本溢出 : ellipses does not work when parent width is fixed and child width is dynamic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44744831/
我正在使用 TextView 在两行中编写文本描述。我正在使用 android:gravity="center"将两条线居中对齐,也使用了android:maxLines="2" & android:
我试图在椭圆路径中移动多个 Sprite (图像),使距离(弧距)保持一致。 我试过了 按角度移动每个 sprite 角度,但是这样做的问题是,围绕长轴移动单位角度时移动的距离与围绕短轴移动单位角度时
我正在尝试弄清楚如何判断鼠标是否位于 HTML5 Canvas 上的椭圆上。我需要比边界框检查更精确。 抱歉,这是一个模糊的问题。我完全被难住了。 任何帮助将不胜感激。 到目前为止我有这个: // T
我是 svg 的新手。我想做的是用 JS 创建一个椭圆元素并将其附加到 SVG 标签。 HTML代码是 下面是JS代码 var el=document.create
我正在使用 OpenCV 并检测用户的 body 。但我收到错误: No matching function for call to 'ellipse' 该函数存在于我的框架中,但它仍然显示错误: /
我正在构建一个新的 InfoWindow (google maps api v2),我正在努力让我的布局变得完美。该布局的一部分是这样的: 现在,问题出在 android:ellipsize
我试图在具有多行文本的 TextView 末尾获取省略号。 “...”正在显示,但它位于文本的最后一个空格,其他字符后跟其他字符。如何确保“...”始终位于末尾。 参见示例图片 XML 布局文件是:
在我的三星 Galaxy Nexus 上,行为正常,它显示三个点,但在三星 S2 中,它只显示一个点。只有一个布局文件: 这是例子: http://img109.imageshack.us/img1
android:ellipsize="end" 不工作,当我使用 android:ellipsize="marquee" 时,应用程序崩溃。 这是我的代码: 最佳答案 只需在xml文件中使用即可 a
这个问题已经有答案了: Android TextView with multiline and "android:ellipsize = middle" (5 个回答) 已关闭 6 年前。 我有一个A
我正在开发 Squares 游戏的一个版本。为此,我需要检测我的椭圆何时被单击。但问题是我的方法正在使用一个 Ellipse 对象。如何检测哪个椭圆被单击?这是我的代码。 主广场类 public st
我正在使用一个简单的微调器: final SimpleCursorAdapter statusAdapter = new SimpleCursorAdapter(this, android.R
这个问题在这里已经有了答案: Setting Ellipsize on TextView reduces lines shown by one (instead of only ellipsizin
我正在处理包含在 ConstraintLayout 中的 TextView。 如果文本的长度超过 maxLength,我希望 ellipsize 在文本末尾(在 TextView 中)添加三个点。 m
我一直在尝试将此 CSS 应用于某些部分,但尽管阅读了样式,并记得将 overflow:hidden 与 text-overflow 一起包含在内,但我无法让它工作。下面是一些没有文本溢出样式的代码。
MFC:我读到这段代码是绘制一个椭圆(内部不是实体),但我不明白为什么这里需要两次函数“pDC->Ellipse(...)”?(sol == 0, and do_what==DRAW_ELLIPSE)
如何获取在多行 TextView 中未被截断的字符串部分。例如,如果我有“这是一些如您所见相当长的文本”,而 TextView 会显示“这是一些文本……”,那么我想将第二个字符串放入某个变量中。最简单
在我的一个项目中(VC++2010,MFC),我想用CDC::Ellipse画一个圆。我设置了两个点:第一个是圆心,第二个是我希望它在圆周上的一个点。 我将左上角和右下角的坐标传递给 CDC::Ell
我有很多类似以下的图像(只有白色和黑色): 我的最后一个问题是找到匹配良好的椭圆。不幸的是,真正使用过的图像并不总是那么好。它们可能会变形一些,这使得椭圆匹配可能更困难。 我的想法是找到“断点”。我在
我已经设置了一个 TextView 如下: 内部文本由布局充气器以编程方式设置,文本来自 XML 提要。我检查了源代码,没有杂散字符或换行符。 在运行 Android 4.3 的 Nexus 4 上
我是一名优秀的程序员,十分优秀!