我需要按照螢屏截圖所示做,但我不明白該怎么做。我嘗試與 連接baseline,但沒有成功。
我的代碼在這里:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@ id/rl_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</RelativeLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@ id/top_layout"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rl_bar">
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@ id/bottom_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/elegant_black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/top_layout">
</androidx.appcompat.widget.LinearLayoutCompat>
<de.hdodenhof.circleimageview.CircleImageView
android:src="@color/elegant_black"
app:layout_constraintBaseline_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
我怎樣才能做到這一點?
截圖示例:

這就是我得到的:

uj5u.com熱心網友回復:
開始了。試試這個。干杯。
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginStart="20dp"
android:background="@color/elegant_black"
app:civ_border_color="@android:color/white"
app:civ_border_width="2dp"
app:layout_constraintBottom_toTopOf="@id/bottom_layout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/top_layout" />
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/380033.html
標籤:安卓 xml android-线性布局 android-相对布局 android-constraintlayout
上一篇:如何創建XML決議器?
