AndroidConstraintLayout制約レイアウト幅0dpconstrainedWidthパーセンテージレイアウトの使用

左側にレイアウトがあります。参考として右側のレイアウト、中央のテキスト

コード

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".MainActivity">


    <LinearLayout
        android:id="@+id/left"
        android:layout_width="100dp"
        android:layout_height="match_parent"
        android:background="@android:color/holo_green_dark"
        android:orientation="horizontal"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <LinearLay

おすすめ

転載: blog.csdn.net/mp624183768/article/details/124462024