【发布时间】:2020-01-16 18:43:32
【问题描述】:
在我的 android 项目中,我从我的服务器获得一个 string,然后从该 string 将值放入 textview。
XML:
<RelativeLayout
android:id="@+id/scorelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
Java:
RelativeLayout relativeLayout = view.findViewById(R.id.scorelayout);
TextView Score = new TextView(context);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT
);
relativeLayout.addView(Score, layoutParams);
【问题讨论】:
-
向您的文本视图添加文本。
-
不清楚您当前的解决方案遇到了什么问题
-
它不起作用,textview由于某种原因没有出现