UI元件對齊角落 === ```xml <?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" android:orientation="vertical" android:padding="20dp"> <android.support.v7.widget.CardView android:id="@+id/card_1" android:layout_width="0dp" android:layout_height="200dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_marginTop="8dp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <android.support.v7.widget.CardView android:id="@+id/card_2" android:layout_width="100dp" android:layout_height="100dp" android:layout_marginBottom="8dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_marginTop="0dp" app:cardBackgroundColor="#69F" app:layout_constraintBottom_toBottomOf="@+id/card_1" app:layout_constraintLeft_toLeftOf="@+id/card_1" app:layout_constraintRight_toRightOf="@+id/card_1" app:layout_constraintTop_toBottomOf="@+id/card_1" /> </android.support.constraint.ConstraintLayout> ``` ## Ref. [Android - Constraint layout - How to align a view centered over edge of other view?](https://stackoverflow.com/questions/46645517/android-constraint-layout-how-to-align-a-view-centered-over-edge-of-other-vi) ###### tags: `實作相關`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up