입력 문자 수 제한하기

Category:
Author: zemna
Date: April 17, 2021
Share this:

입력할 수 있는 문자의 수를 제한하는 방법.

- setFilters(InputFilter[] filters) 함수를 사용한다. - InputFilter.LengthFilter(int max) 함수를 사용하여 원하는 자리수를 지정한다.

[code lang="java"] public class TextChange extends Activity {

EditText mEdit;

/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

// Find edit box mEdit = (EditText)findViewById(R.id.edit);

// Apply Filters mEdit.setFilters(new InputFilter[] { new InputFilter.LengthFilter(3) }); } } [/code]

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *

Let's connect and create
something awesome together!
2023 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️
crossmenu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram