在一个TextView使用制表/ tabspace [英] Using tabulator / tabspace in a TextView

查看:186
本文介绍了在一个TextView使用制表/ tabspace的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用一些tabspace在一条线上,我打电话的setText

I wish to use some tabspace in a line where I call setText

if(id==R.id.radioButton1){
            title.setText(numbertext.getText()+" Grams");

在这种情况下,我想()numbertekst.getText之间标签和克。 的输出是与值的简单行的一部分。但正如我无法找到该选项卡,该行是有点难看。

In this case I would like to tab between numbertekst.getText() and the grams. The output is part of a simple row with values. But as I can't find the tab, the row is a little ugly.

我知道我可以使用多个文本框,甚至一个表。但是,当我有很多的code已经我不想走那条路呢。

I know I can use multiple textfields or even a table. But as I have a lot of code already I don't want to go that way yet.

我试过了Java的方式与推杆\ T,但似乎不工作。

I tried the Java way with putting \t, however that seems not to work.

任何帮助将是AP preciated。

Any help would be appreciated.

推荐答案

您应该添加制表的文字,但\ t不中的setText工作。解决的方法是添加字符 \ u0009 的再presents在UNI code炭制表,在一个字符串资源。

You should add tabulator to the text, but \t don't work in settext. The solution is add the character \u0009 that represents in unicode char the tabulator, in a string resource.

<string name="tab">\u0009</string>

TextView hello = (TextView) findViewById(R.string.helloTextView);

hello.setText("e"+getString(R.string.tab)+"e");

只需将更多的标签,有更多的空间

just combine more tab to have more space

getString(R.string.tab)+getString(R.string.tab)+getString(R.string.tab)

这篇关于在一个TextView使用制表/ tabspace的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆