0
가
안드로이드 스튜디오에서 나는 다음과 같이하기 위해 새로운 Activity
UI를 디자인 일관성이 상단 왼쪽 코너에서 서로의 위에 (나는 스크린 샷을 포함하고 싶지만 Imgur 또는 AWS S3에는 문제가있어서 SO를 업로드 할 수 없습니다).안드로이드 ConstraintLayouts는
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.zacharvey.freedomawsapp.MatchSetupActivity">
<TextView
android:id="@+id/textView"
android:layout_width="156dp"
android:layout_height="27dp"
android:text="Match Setup"
android:textSize="18sp"
tools:layout_editor_absoluteY="1dp"
android:layout_marginLeft="16dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView5"
android:layout_width="146dp"
android:layout_height="23dp"
android:layout_marginLeft="16dp"
android:text="Consent Type:"
android:textSize="14sp"
tools:layout_editor_absoluteY="64dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/textView5" />
<RadioButton
android:id="@+id/consent.voice"
android:layout_width="166dp"
android:layout_height="31dp"
android:checked="true"
android:defaultFocusHighlightEnabled="false"
android:text="Voice-Activated"
tools:layout_editor_absoluteY="95dp"
android:layout_marginRight="202dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/textView5" />
<RadioButton
android:id="@+id/consent.switch"
android:layout_width="201dp"
android:layout_height="28dp"
android:text="Connected Switches"
tools:layout_editor_absoluteY="126dp"
android:layout_marginLeft="16dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/consent.voice" />
<TextView
android:id="@+id/textView7"
android:layout_width="129dp"
android:layout_height="19dp"
android:layout_marginLeft="16dp"
android:text="Go Offset:"
tools:layout_editor_absoluteY="196dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/consent.switch" />
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Min (sec):"
android:layout_marginLeft="16dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/textView7" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="Max (sec):"
tools:layout_editor_absoluteY="290dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/textView8" />
<EditText
android:id="@+id/offset.min"
android:layout_width="38dp"
android:layout_height="32dp"
android:ems="10"
android:inputType="textPersonName"
android:text="1"
tools:layout_editor_absoluteY="233dp"
tools:layout_editor_absoluteX="107dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/textView9" />
<EditText
android:id="@+id/offset.max"
android:layout_width="37dp"
android:layout_height="38dp"
android:ems="10"
android:inputType="textPersonName"
android:text="4"
tools:layout_editor_absoluteY="290dp"
tools:layout_editor_absoluteX="108dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/offset.min" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="toO1Login"
android:text="Next >>"
tools:layout_editor_absoluteY="398dp"
android:layout_marginLeft="16dp"
layout_constraintLeft_toLeftOf="parent"
layout_constraintTop_toBottomOf="@+id/offset.max" />
</android.support.constraint.ConstraintLayout>
내 질문 : 왜 내 분 (초)입니다TextView
올바른 위치에 표시하는 경우에만 위젯
여기에 내가 현재 가지고있는 UI의 XML있어? 다른 위젯/뷰를 제대로 배치하기 위해해야 할 일은 무엇입니까?
감사 @Benjamin (+1) - 확인 날이 다른 방법을 물어 보자,의 난 그냥 왼쪽 정렬에 누적 될 내보기/모든 위젯을 원하는 가정 해 봅시다 "첫 번째"뷰가 왼쪽 위 모서리에 나타나고 "두 번째"뷰가 바로 아래에 나타나지만 (다시 왼쪽 정렬 된) 등 어떤 종류의 "세로 정렬"을 산출합니다. 이 작업을 수행하려면 각보기에 XML 속성을 추가해야합니까? 다시 한번 감사드립니다! – smeeb
모든 뷰에서'layout_constraintLeft_toLeftOf = "parent"'를 사용하고, 최상위 뷰에서는'layout_constraintTop_toTopOf = "parent"'를 사용하고 나머지는'layout_constraintTop_toBottomOf = "id_of_the_previous_view"'를 사용하십시오. – Benjamin
@Benjamin (+1)에 감사하지만 위의 업데이트를 참조하십시오. 최근 변경 사항을 추가했지만 여전히 모든 뷰/위젯이 화면의 왼쪽 상단 모서리에 서로 쌓여 있습니다 (z 축). 어떤 아이디어? – smeeb