繁体   English   中英

文本在按钮中左右对齐

[英]Text aligned left and right in a Button

我有一个看起来像的按钮

[1         44.33]

使文本同时向左和向右对齐。

是否可以通过一个元素TextView引入嵌套TextView来实现?

您可以将ellipsize设置为middle ,将Button的singleLine设置为true

<Button
            android:id="@+id/desc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="so that the text is aligned to left and right at the same time.Is it possible to achieve it with a single element, w/o introducing nested TextViews?"
            android:textColor="#888686"
            android:ellipsize="middle"
            android:singleLine="true"
            android:textSize="15dp" />

是的,您可以检查Button Tag中的ellipsize元素。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM