我在我的RecyclerView中有一个句子,其中有3个TextView
。图为象下面这样:在TextView Android中添加另一个字
在那张照片,我有一句话在3 TextView
,有“1”“HOT,更辣椒”和“比萨”。这是我的RecyclerView绑定代码:
try {
view.txtArticlesName.setText(/*orderList.getJSONObject(position).getString("quantityValue") +*/
/*orderList.getJSONObject(position).getString("spesial-request").replaceAll("[\\\"\\[\\]]", "") + */
orderList.getJSONObject(position).getString("bezeich"));
view.txtQty.setText(orderList.getJSONObject(position).getString("quantityValue"));
view.txtReqList.setText(orderList.getJSONObject(position).getString("spesial-request").replaceAll("[\\\"\\[\\]]", ""));
} catch (JSONException e) {
e.printStackTrace();
}
我想参加所有的TextView
只有一个“TextView`动态地。我会尝试这个办法:
view.txtArticlesName.setText(/*orderList.getJSONObject(position).getString("quantityValue") +*/
/*orderList.getJSONObject(position).getString("spesial-request").replaceAll("[\\\"\\[\\]]", "") + */
orderList.getJSONObject(position).getString("bezeich"));
但它不能正常工作,它不是将数据绑定,所以TextView
只显示默认的文本“Hello World”。 TextView
可以做到这一点吗?我也读了Spannable,但我不知道它的工作如何在一个TextView
中添加新词。或者有另一种方法可以做到这一点?任何建议和答案将有助于我。以前感谢。
也许你有例外。并且此代码从不执行。只是看到日志猫或使用日志,以确保所有此代码执行 –
@farazkhonsari我的日志没有显示任何错误。当我点击比萨或其他食物从另一个RecyclerView itss成功广告到这个RecyclerView,但TextView只显示“Hello World” –