답변
분명히이 작업에는 여러 가지 방법이 있으며 FrameLayout, LinearLayout, RelativeLayout 등과 같은 다른 유형의보기 그룹을 조회하는 것이 좋습니다.
귀하의 질문에 관해서는 여기에 기본적인 접근 방식이 있습니다. 이제는 나와 함께 할 일이 많지 않으므로 이미지와 거의 비슷하게 보입니다.
LinearLayouts를 활용하여 레이아웃과 같은 "스태킹"을 사용합니다.
<?xml version="1.0" encoding="utf-8"?>
<!-- LayoutA -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- LayoutB -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="A" />
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="A" />
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="A" />
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="A" />
</LinearLayout>
<!-- LayoutC -->
<LinearLayout
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="A" />
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="A" />
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="A" />
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="A" />
</LinearLayout>
</LinearLayout>
의 LinearLayout (A)이 수직으로 위쪽에서 "스택"것이다 개의 자식이 (방향 = "수직") 및 두 개의 자식 (B) 및 (C) "에 적층되어있는 버튼이 "왼쪽에서 수평으로 (orientation ="horizontal ").
아, 그리고 (C) 때문에 설정 중력의 화면의 중앙에 (layout_gravity = "center_horizontal") 당신이 당신의 버튼의 텍스트를 변경하는 경우, 당신이 중 하나를 만들기 위해 할 수
버튼의 너비를 넓히거나 wrap_content를 사용하십시오.
놀아보고 즐기십시오! :)
고마워요! 그것은 많은 도움이되었습니다. layout_gravity의 값을 사용자 정의하는 방법이 있습니까? 그래서 레이아웃 (두 번째 버튼 라인)을 왼쪽 또는 오른쪽으로 몇 픽셀 이동시킬 수 있습니까? – user3367856
예를 들어 레이아웃 C에서 layout_gravity를 사용할 필요는 없습니다. 대신 margin_left = "... dp"로 변경할 수 있습니다. 또는 함께 사용하여 전화기 화면 가운데에서 추가로 가져올 수 있습니다. 오, 당신은 반대편에 갈 것 인 마진에 음수를 넣을 수 있습니다. –
이 두 가지 설정을 결합 할 수 있는지 알지 못했습니다. – user3367856
- 1. 배치 요소는
- 2. IE7 배치 요소는 부모
- 3. 상대적으로 배치 된 요소는 절대적으로 어떻게 배치합니까?
- 4. 어떻게 배열의 요소는 자바
- 5. Zend_Form_File 요소는 어떻게 사용합니까?
- 6. 이 요소는 어떻게 선택합니까?
- 7. 하위 요소는 어떻게 선택합니까?
- 8. ArrayList의 요소는 어떻게 작동합니까?
- 9. 구성 요소는 어떻게 자녀의 레이아웃을 수행 할 수 있습니까?
- 10. sleekxmpp 구성 요소는 어떻게 작동합니까?
- 11. 배치 파일이 다른 배치 파일을 어떻게 호출 할 수 있습니까?
- 12. 요소는 .NET의 컨테이너에 어떻게 저장됩니까?
- 13. 소프트웨어 구성 요소는 어떻게 정의합니까?
- 14. 타이머 구성 요소는 어떻게 폴링합니까?
- 15. 이 JQuery 요소는 어떻게 찾습니까?
- 16. 요소는 클릭 할 수 있습니다 :
- 17. 어떻게 그래픽을 배치 할 때 십진수를 사용합니까?
- 18. 어떻게 그림을 라텍스에 배치 할 수 있습니까?
- 19. MPVolumeView를 어떻게 배치 할 수 있습니까?
- 20. 어떻게 이런 요소를 배치 할 수 있습니까?
- 21. 상대적으로 배치 된 블록 요소는 부모의 크기에 영향을줍니다.
- 22. UITableView에서 한 줄 아래에 내용을 어떻게 배치 할 수 있습니까?
- 23. 요소는
- 24. Android 갤러리 구성 요소는 어떻게 사용자 정의 할 수 있습니까?
- 25. DBGrid 구성 요소는 표시 할 초기 열 너비를 어떻게 결정합니까?
- 26. 이 요소는 무엇이며 어떻게 클릭 할 수 있습니까?
- 27. 하위 구성 요소는 어떻게 React-Native로 통신 할 수 있습니까?
- 28. 요소는
- 29. 배경 요소는 IE9에 절대적으로 배치 된 링크를 통해 선택 가능합니다.
- 30. 절대 위치에 배치 된 요소는 고정 된 위치에 배치했습니다.
코드 없음, 해결책 없음. –
코드가 없습니다. 나는 포토샵에서 내가하고 싶은 것을 보여주기 위해 이것을 만들었다. 어떤 레이아웃을 사용하는지 간단한 설명이나 아이디어가 좋을 것입니다. – user3367856