...

반응형
1
android:imeOptions="actionSearch"
cs

XML에 EditText 속성에 위와 같은 옵션을 넣고

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
searchbox = (EditText) findViewById(R.id.edtsearch);
 
        searchbox.setOnEditorActionListener(new TextView.OnEditorActionListener() { // EDITTEXT 검색키 눌렀을 경우 처리 부분
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                switch (actionId)
                {
                    case EditorInfo.IME_ACTION_SEARCH:
                        Toast.makeText(getApplicationContext(), "검색", Toast.LENGTH_LONG).show();
                        return true;
                    default:
                        return false;
                }
 
            }
        }); // setOnEditorActionListener END
cs

자바소스에 위와 같이 처리 부분을 넣는다.


반응형