Android 按钮中左右对齐的文本

Android 按钮中左右对齐的文本,android,button,text,justify,Android,Button,Text,Justify,我有一个按钮,看起来像 [1 44.33] 使文本同时左对齐和右对齐 是否可以使用单个元素实现它,而不引入嵌套的TextViews?您可以将按钮的省略设置为中间,并将单行设置为真 <Button android:id="@+id/desc" android:layout_width="wrap_content" android:layout_height="wrap_content"

我有一个按钮,看起来像

[1         44.33]
使文本同时左对齐和右对齐


是否可以使用单个元素实现它,而不引入嵌套的
TextView
s?

您可以将按钮的
省略设置为
中间
,并将
单行
设置为

<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" />


是的,您可以检查按钮标记中的省略号元素

这是单按钮还是你想要开关?如果你提供你想要的屏幕截图更好。没有开关。显然,我不相信有任何标准的方法来实现对齐。但是,您可以在数值之间添加内置选项卡,以便在单个按钮中始终保持它们之间的空间。
按钮
继承自
文本视图
,我认为您无法通过一个文本视图获得“足够好”的结果。这就是您想要的,对吗?对不起,中间没有椭圆点。更新了我原来的问题