2012-12-06 4 views
1
<string name="text_9">This may not happen. If this happened, reset in 2&#8211;4 mins.</string> 

나는 이런 식으로 그것을 사용 :Android에서 strings.xml 파일의 쉼표를 교체해야합니까?

AlertDialog alertDialog = new AlertDialog.Builder(this).create(); 
alertDialog.setMessage(getResources().getText(R.string.text_9));  

layout.xml가 표시되는 결과는 항상

<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> 

처럼 보인다 "이런 일이되지 않을 수 있습니다 이런 일합니다.". 쉼표가 모두 표시되지 않았습니다. 나는 콤마를 '\,'및 '\ u002c'로 대체하려고 시도했지만 어느 것도 작동하지 않습니다. 쉼표를 제거하면 모든 것이 표시됩니다.

전체 설명을 대체하기 위해 쉼표를 어떻게 대체합니까?

AlertDialog alertDialog = new AlertDialog.Builder(this) 
.setMessage(R.string.text_9) 
.create(); 
alertDialog.show(); 

또는 getString(R.string.text_9)으로 getResources().getText(R.string.text_9) 방법을 대체 :

+2

문자열은 문제가 없습니다. TextView에서 사용하고 있습니까? 레이아웃 xml을 게시하십시오. – brillenheini

+0

layout.xml은 대화 상자의 사용자 정의 레이아웃입니까? 어떻게 사용합니까? – brillenheini

답변

1

create() 메서드를 호출하기 전에 메시지를 설정하려고하십시오.

관련 문제