【问题标题】:Android Textview setText inner LayoutAndroid Textview setText 内部布局
【发布时间】:2017-04-25 19:08:17
【问题描述】:

我想这样设置文本

String Result = "Customer Name :"+getSpace()+CustomerName+System.getProperty ("line.separator")+
    "Customer Age :"+getSpace()+CustomerAge+System.getProperty ("line.separator")+
    "Money  :"+getSpace()+CustomerMoney+System.getProperty ("line.separator");
        ExampleTextView.setText(Result );

功能代码

public String getSpace(){

 String Space="";
 for(int i=0;i<getSpaceCount();i++)
 {
  Space+=" ";
 }

}

比我想要的结果之后像这样 |

|Customer Name :        Akshan Ormani To|
|Customer Age :                       19| 
|Money :                           20.0€|

【问题讨论】:

    标签: android android-layout textview


    【解决方案1】:

    我想您可以为此使用AlignmentSpan.Standard。不过我不确定,我自己没试过。

    See here for an example

    【讨论】:

      猜你喜欢
      • 2020-11-11
      • 1970-01-01
      • 2016-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-07
      • 1970-01-01
      相关资源
      最近更新 更多