티스토리 뷰
Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.
Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.
아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.
First letter capitalization for EditText
EditText에서 첫 글자 대문자 처리하는 방법
문제 내용
I'm working on a little personal todo list app and so far everything has been working quite well. There is one little quirk I'd like to figure out. Whenever I go to add a new item, I have a Dialog with an EditText view showing inside. When I select the EditText view, the keyboard comes up to enter text, as it should. In most applications, the default seems to be that the shift key is held for the first letter... although it does not do this for my view. There has to be a simple way to fix, but I've searched the reference repeatedly and cannot find it. I'm thinking there has to be an xml attribute for the reference loaded by the Adapter, but I can't find out what it is.
제 개인용 ToDo 리스트 앱을 작업 중이며 지금까지 모든 것이 꽤 잘 작동했습니다. 새 항목을 추가하려고 할 때마다 내부에 EditText 뷰가있는 대화 상자가 나타납니다. EditText 뷰를 선택하면 텍스트를 입력하려면 키보드가 나타납니다. 대부분의 애플리케이션에서는 기본적으로 첫 글자에 대한 쉬프트 키를 누르는 것처럼 보입니다. 그러나 제 뷰에서는 이렇게 동작하지 않습니다. 해결 방법이 있을 것으로 생각되지만 참조를 반복해서 검색해도 찾을 수 없습니다. 어댑터에로드 된 참조에 대한 xml 속성이 있어야한다고 생각하지만 어떤 것인지 알 수 없습니다.
높은 점수를 받은 Solution
Statically (i.e. in your layout XML file): set android:inputType="textCapSentences"
on your EditText
.
정적으로 (즉, 레이아웃 XML 파일에서) : EditText에서 android:inputType="textCapSentences"를 설정하십시오.
Programmatically: you have to include InputType.TYPE_CLASS_TEXT
in the InputType
of the EditText
, e.g.
프로그래밍 방식 : EditText의 InputType에 InputType.TYPE_CLASS_TEXT를 포함해야합니다. 예를 들어,
EditText editor = new EditText(this);
editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
Can be combined with text and its variations to request capitalization of the first character of every sentence.
텍스트와 그 변형과 결합하여 각 문장의 첫 글자를 대문자로 요청할 수 있습니다.
- 구글 문서
가장 최근 달린 Solution
If you want capital first letter in every word then use android:inputType="textCapWords"
모든 단어의 첫 글자를 대문자로 하려면 android:inputType="textCapWords"를 사용하십시오.
For Better understanding
이해를 돕기 위해
<EditText
android:id="@+id/edt_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
And if you capital word for every sentence then use it . android:inputType="textCapSentences"
this line in your xml. I mean in your EditText.
각 문장에서 대문자로 시작하는 단어를 사용하려면 android:inputType="textCapSentences" 이를 xml에 사용하십시오. EditText에서.
For Better understanding
더 나은 이해를 위해
<EditText
android:id="@+id/edt_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences"/>
출처 : https://stackoverflow.com/questions/4808705/first-letter-capitalization-for-edittext
'개발 > 안드로이드' 카테고리의 다른 글
응용프로그램의 시작 액티비티 변경 (0) | 2022.12.27 |
---|---|
assets 폴더의 로컬 JSON 파일을 ListView로 불러오기 (0) | 2022.12.27 |
안드로이드 버튼 비활성화하기 (0) | 2022.12.26 |
RelativeLayout에 백분율 너비(Percentage width) 적용하기 (0) | 2022.12.26 |
Android View의 상단과 하단에 테두리 쉽게 추가하기 (0) | 2022.12.26 |