Android TextView : “Do not concatenate text displayed with setText”

前端 未结 10 1522
小鲜肉
小鲜肉 2020-12-02 04:01

I am setting text using setText() by following way.

prodNameView.setText(\"\" + name);

prodOriginalPriceView.setText(\"\" + String.format(g         


        
10条回答
  •  执笔经年
    2020-12-02 04:38

    You should check this thread and use a placeholder like his one (not tested)

    Price : %1$d
    
    String text = String.format(getString(R.string.string_product_rate_with_ruppe_sign),new BigDecimal(price).setScale(2, RoundingMode.UP));
    prodOriginalPriceView.setText(text);
    

提交回复
热议问题