我们需要在Android中替换strings.xml文件中的逗号吗?
layout.xml看起来像我们需要在Android中替换strings.xml文件中的逗号吗?,android,Android,layout.xml看起来像 AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setMessage(getResources().getText(R.string.text_9)); 显示的结果总是“这可能不会发生。如果发生了”。 逗号之后的一切都没有出现。我试图用“\”和“\u002c”替换逗号,但两者都不起作用。如果删除逗号,所有内容都将显示 如何替换逗号以替换完整描述
AlertDialog alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setMessage(getResources().getText(R.string.text_9));
显示的结果总是“这可能不会发生。如果发生了”。
逗号之后的一切都没有出现。我试图用“\”和“\u002c”替换逗号,但两者都不起作用。如果删除逗号,所有内容都将显示
如何替换逗号以替换完整描述 在调用
create()
方法之前,请尝试设置消息:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="15dp" >
<TextView
android:id="@+id/explain_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#00000000" />
</LinearLayout>
或者将
getResources().getText(R.string.text_9)
方法替换为getString(R.string.text_9)
请在调用create()
方法之前尝试设置消息:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="15dp" >
<TextView
android:id="@+id/explain_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#00000000" />
</LinearLayout>
或者将
getResources().getText(R.string.text_9)
方法替换为getString(R.string.text_9)
您的字符串很好。您是否在文本视图中使用它?请发布它的布局xml。那么layout.xml是对话框的自定义布局吗?你怎么用?你的绳子很好。您是否在文本视图中使用它?请发布它的布局xml。那么layout.xml是对话框的自定义布局吗?你如何使用它?
AlertDialog alertDialog = new AlertDialog.Builder(this)
.setMessage(R.string.text_9)
.create();
alertDialog.show();