2014-03-31 8 views

답변

4

아주 쉽게, 당신이 호출하게해야합니다 :

char firstCharacter = myTextView.getText().charAt(0); 
3

은 첫 글자를 얻으려면 다음과 같은 방법을 시도 할 수 있습니다

또는
String strTextview = textView.getText().toString(); 
strTextView = strTextView.substring(0,1); 

1

을 간단합니다. 텍스트 뷰의 텍스트를 검색하려면 getText().toString();

String textViewContent = textViewInstance.getText().toString(); 

를 사용해야하고, 첫 글자는 textViewContent.charAt(0)

2

은 아래 방법을 사용합니다. TextView에서 문자열을 매개 변수로 제공하십시오.

public String firstStringer(String s) { 
      String str= s.substring(0, Math.min(s.length(), 1)); 
      return str; 
     } 
1

당신은 텍스트 뷰에서 문자열의 내용을 가져 오기 위해이

TextView tv = (TextView) findViewById(R.id.textview); 
    String frstLetter = tv.getText().substring(0, 1); 
+0

편집 주셔서 감사합니다. @InnocentKiller – EdmDroid

+1

NP, 좋은 답변, +1에서 myside. – InnocentKiller

+1

죄송합니다. 'TextView'에 두 단어가있는 경우 두 번째 단어의 첫 번째 문자는 어떻게 가져 옵니까? – user2847219

1

를 사용할 수 있습니다

String content = textView.getText().toString(); 

가 첫 번째 문자를 가져올 수

char first = content.charAt(0); 
1

시도
String value = text.getText().toString(); 
String firstTen = value.substring(0, 1); 
관련 문제