0
Android의 구속 조건 레이아웃을 사용하면 어떻게 여러 요소 주위에 단일 테두리를 배치 할 수 있습니까? 제약 조건 레이아웃의 주요 이점 중 하나는 뷰를 중첩 할 필요가 없다는 것입니다. 이것은 제약 레이아웃의 다른 레이아웃을 사용하는 하나의 시나리오입니까?제약 레이아웃에서 여러 요소 주위에 단일 테두리를 두는 방법은 무엇입니까?
Android의 구속 조건 레이아웃을 사용하면 어떻게 여러 요소 주위에 단일 테두리를 배치 할 수 있습니까? 제약 조건 레이아웃의 주요 이점 중 하나는 뷰를 중첩 할 필요가 없다는 것입니다. 이것은 제약 레이아웃의 다른 레이아웃을 사용하는 하나의 시나리오입니까?제약 레이아웃에서 여러 요소 주위에 단일 테두리를 두는 방법은 무엇입니까?
코드를 더 이상 보지 않고도 실제 레이아웃이 어떤 모양인지 알 수 없습니다. 하지만이의 의견
<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">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/border"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_margin="4dp"
app:layout_constraintBottom_toBottomOf="@id/guideline"/>
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.7"/>
<View
android:id="@+id/v1"
android:layout_width="100dp"
android:layout_height="200dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="#8FF0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/v2"
android:layout_width="200dp"
android:layout_height="100dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:background="#8F0F"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/v3"
android:layout_width="100dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:background="#80FF"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v1"
app:layout_constraintBottom_toBottomOf="@id/guideline"/>
<View
android:id="@+id/v4"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:background="#8000"
app:layout_constraintBottom_toTopOf="@+id/v5"
app:layout_constraintEnd_toStartOf="@+id/v2"
app:layout_constraintStart_toEndOf="@+id/v1"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/v5"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="#8000"
app:layout_constraintBottom_toBottomOf="@+id/v3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/v1"
app:layout_constraintTop_toBottomOf="@+id/v2" />
</android.support.constraint.ConstraintLayout>
이 그 색깔의 견해가 일부 일부 위젯은
같은 출력이 모습입니다 중 하나를 중첩하지 않고 일부 레이아웃 주위에 테두리를 그릴 수있는 한 가지 방법은 레이아웃에 배치되었습니다. 그리고 국경은 다른 관점에서 설정되었습니다.
아니요. 중첩하지 않고이 작업을 수행 할 수 있습니다. 하지만 실제로 레이아웃이 실제로 어떻게 보이는지에 따라 많이 달라집니다. –
https://constraintlayout.github.io/cookbook/background.html –