ListView의 하위 요소 인 EditText에서 일부 텍스트를 선택하고 싶습니다. 선택한 텍스트는 클립 보드에 설정해야합니다. 이에 관한 예를 찾을 수 없습니다. 어떻게해야합니까? selectionStart 및 selectionEnd는 이에 대해 작동하지 않습니다. 감사합니다. .복사 할 텍스트를 선택하십시오. Android EditText
답변
EditText는 이미 길게 누르기에서이 기능을 제공합니다 .... editText에 긴 터치를 누르는 것을 의미합니다. 전체 선택 메뉴, 텍스트 선택, 모두 복사를 묻는 컨텍스트 메뉴로 팝업됩니다.
목록보기에서 그렇게 해보고 나중에 논의 할 수 있습니다. –
미안하지만, ListView에서 같은 것을 보지 못했다는 것이 내 실수였습니다. 이제 어떻게해야하는지 궁금합니다. – Kri
사용 당신은 EDITTEXT 긴 클릭 이벤트 inlistView 사용자 정의 어댑터 및 표시이 옵션 사본에 하나의 대화 상자를 열고 그 안에 붙여 넣을 수 있습니다
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); clipboard.setText(txtEdit.getText().toString());
시도해도되지만 작동하지 않습니다. 나는 가능한 모든 방법을 시도해 왔습니다. 그러나 그것은 효과가없는 것처럼 보입니다. android에서 목록 초점에 문제가 있습니다. 그것은 항상 하위 요소와 상위 요소를 혼동합니다. –
리스트 선택 이벤트에이 코드
텍스트를 복사 할 수 있습니다 programically
ClipboardManager clipboard =
(ClipboardManager) c1.getSystemService(c1.CLIPBOARD_SERVICE);
clipboard.setText("Text to copy");
를 사용하여 텍스트를 얻을
System.out.println(clipboard.getText());
문제를 이해하지 못합니다. Listview는 자식 요소에 문제가 있습니다. –
가능한 해결책은 다음과 같습니다. 목록보기의의 getView 방법으로 수술 후 수행
은 ExtractedText에 의해 주어진enter code here:
public View getView(final int position, View convertView, ViewGroup parent) {
// A ViewHolder keeps references to children views to avoid unneccessary calls
// to findViewById() on each row.
final ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.main, null);
// Creates a ViewHolder and store references to the two children views
// we want to bind data to.
holder = new ViewHolder();
holder.subText = (TextView) convertView.findViewById(R.id.subTxt);
convertView.setTag(holder);
} else {
// Get the ViewHolder back to get fast access to the TextView
// and the ImageView.
holder = (ViewHolder) convertView.getTag();
}
//TEXT BOX position is 0 then
if(position == 0) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); clipboard.setText(txtEdit.getText().toString());
}
return convertView;
}
이것은 작동하지 않을 것입니다. editText는 이것에 초점을 두지 않을 것입니다. –
InputConnection ic = getCurrentInputConnection();
ExtractedText extracted = ic.getExtractedText(
new ExtractedTextRequest(), 0);
/*If selection start and end are not equal then selected text
* needs to be deleted and updated to core*/
if (extracted!= null && extracted.selectionStart != extracted.selectionEnd) {
}
사용 API를
는- 1. Android EditText
- 2. 텍스트를 변경할 때 EditText 스크롤을 중지하십시오 (Android)
- 3. Android EditText : 텍스트를 왼쪽으로 이동 하시겠습니까?
- 4. 파일의 모든 텍스트를 선택하십시오.
- 5. Android EditText 배경 텍스트
- 6. EditText : 복사 할 때 이미지를 문자열로 변경 하시겠습니까?
- 7. Android EditText 로딩 늦음
- 8. Android EditText 버튼에 연결
- 9. Android EditText : 텍스트 입력
- 10. Android EditText 파일 형식
- 11. Android EditText 힌트
- 12. Android - edittext illusion
- 13. Android EditText isSelectAll() 메소드?
- 14. ListView 내의 Android EditText
- 15. android EditText 및 textformatting
- 16. Android - EditText on status notification
- 17. Android EditText with Google 검색 EditText
- 18. 텍스트를 클릭하여 확인란을 선택하십시오.
- 19. Android EditText 상자
- 20. Android : 런타임에 EditText 만들기
- 21. editText in android
- 22. Android EditText AutoMoveing
- 23. ANDROID EditText onclicklistener?
- 24. android - EditText 타이핑이 느립니다.
- 25. OnTextChangedListener가있는 Android 다중 EditText
- 26. Android : 메뉴에 EditText 표시
- 27. 상단에 EditText 위젯 내부에 텍스트를 어떻게 배치합니까?
- 28. android EditText 힌트가 나타나지 않습니다.
- 29. android edittext onchange listener
- 30. 캔버스 위의 Android EditText
죄송 문제에 필요한 작성하기가 훨씬 더 시간이 없어,의 몇 분 SO 검색 날이 준 링크를 클릭하면 도움이 될 것입니다. 만약 당신이 이미 이것을 시도했다면 sorry.http : //stackoverflow.com/questions/2679948/focusable-edittext-inside-listview – kosa
나는 explicity에 코멘트가 시간이 없다고 말했다. 너무 많이 쓰지 말아라. 여기서 문제는 귀하와 커뮤니티가 귀하를 도우려는 것입니다. 지역 사회가 당신을 위해 모든 것을 쓸 것이라고 생각하지 마십시오. 링크가 유용하지 않으면 무시할 수 있습니다. 당신의 모든 반응은 받아쓰기가 좋지 않습니다. – kosa
이봐, 나는 아무 것도 지시하지 않는다. 나는 정크 션 답장에서 커뮤니티를 막으려 고하고있다. 나를 오해하지 마라. –