버튼을 클릭 할 때 응용 프로그램에 편집 텍스트 필드를 추가하고 싶지만 레이아웃을 변경하지 않습니다. xml 파일에 정의 된 기존 파일 아래에 파일을 추가하기 만하면됩니다. 연락처 앱이 있고 사용자가 추가 필드를 추가해야 버튼을 누르고 하나를 만들면됩니다. 어떻게 그럴 수 있습니까?동적으로 텍스트 편집을 추가하십시오.
-2
A
답변
1
EditText를 패널에 그룹화 한 다음 버튼을 클릭하고 버튼을 클릭하여 EditText의 인스턴스를 만들고 관련 패널에 추가 할 수 있습니다. 이렇게하면 한 패널 만 추가 할 수는 있지만 사용자가 추가하려는만큼만 패널을 추가 할 수는 없습니다.
5
레이아웃에 EditText 항목을 유지하고 가시성을 으로 설정하고으로 설정하십시오. 버튼 세트 시인성 onclick 이벤트에이어서
<EditText android:visibility="gone" android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
표시한다. 또는
당신은 프로그래밍의 EditText 항목을 추가 할 수 있습니다.XML에 LinearLayout을 추가하십시오.
<LinearLayout
android:id="@+id/editTextGroupLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
버튼 클릭 이벤트는 프로그래밍 방식으로 EditText를 추가합니다.
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.editTextGroupLayout);
EditText editTextView = new EditText(this);
editTextView.setGravity(Gravity.CENTER);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, 1);
editTextView.setLayoutParams(params);
linearLayout.addView(editTextView);
희망이 도움이 될 것입니다.
0
먼저 웹 서비스에서 데이터를 호출합니다.
예 : description = Parser.getDescription; 은 XML 레이아웃에서
:
<Button android:id="@+id/button" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:onClick="@string/ButtonClick"/>
<EditText android:id="@+id/note" android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
코드 :
ButtonName = (Button)findViewById(R.id.note);
Data = (EditText)findViewById(R.id.note);
public void ButtonClick(View v){
description = Parser.getDescription;
Data.settext(description);
}
관련 문제
- 1. 동적으로 asp.net에 텍스트 상자를 추가하십시오.
- 2. Jquery와 Tapestry로 동적으로 텍스트 필드를 추가하십시오.
- 3. 동적으로 jQuery Datepicker를 추가하십시오.
- 4. 버튼과 텍스트 편집을 사용하여
- 5. MVVM에 계층 적 데이터 구조로 편집을 추가하십시오.
- 6. 어떻게 동적으로 텍스트 상자 편집을 표시 할 수 있습니까?
- 7. 동적으로 dataGridView에 열을 추가하십시오
- 8. 화면에 동적으로 UIButton을 추가하십시오.
- 9. 동적으로 링크 버튼을 추가하십시오.
- 10. Framelayout에 ViewPager를 동적으로 추가하십시오.
- 11. Infowindow에 이미지를 동적으로 추가하십시오.
- 12. 동적으로 확인란을 추가하십시오
- 13. 컨트롤을 목록보기에 동적으로 추가하십시오.
- 14. 동적으로 열을 행에 추가하십시오.
- 15. 캔버스에 이미지를 동적으로 추가하십시오.
- 16. 동적으로 RangeValidator를 추가하십시오
- 17. JSF에서 동적으로 요소를 추가하십시오.
- 18. ASP.NET Gridview 텍스트 상자에 Gridview 텍스트 상자를 추가하십시오. (gridview 편집시)
- 19. 동적으로 탭 컨트롤 패널에 동적으로 usercontrol을 추가하십시오.
- 20. servlet에 서블릿을 동적으로 추가하십시오 .Config
- 21. C# MenuStrip에 ToolStripMenueItems를 동적으로 추가하십시오.
- 22. 동적으로 HTML 양식에 입력을 추가하십시오.
- 23. 동적으로 페이지를 WPF 마법사에 추가하십시오.
- 24. 은색에 사각형 컨트롤을 동적으로 추가하십시오.
- 25. 보기 그룹에서 레이아웃을 동적으로 추가하십시오.
- 26. rails 애플리케이션에 named_scopes를 동적으로 추가하십시오.
- 27. Asp.Net의 DataGrid에 동적으로 확인란을 추가하십시오.
- 28. Qt - QLineEdit을 동적으로 패널에 추가하십시오.
- 29. 테이블 행에 데이터를 동적으로 추가하십시오.
- 30. jquery 탭에 id를 동적으로 추가하십시오.
가 열 수있는 텍스트 필드의 유한 수있다? buttonClick 이벤트가 발생하면이 순서를 볼 수 있습니다. – AndroidHustle
각 버튼을 클릭 할 때마다 하나씩 – dothedos