、、、
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cons"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Main3Activity">
宽度为parent 的50%
宽高比16 :3
-->
android:id="@+id/banner"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.5"
android:background="#765"
android:gravity="center"
android:text="banner"
app:layout_constraintHorizontal_bias="0"
android:textColor="@android:color/white"
app:layout_constraintDimensionRatio="16:3"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/imgs"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:background="#fd3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/banner" />
当文字过长时会覆盖其他的view
-->
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:layout_constraintBottom_toTopOf="@id/textView3"
android:ellipsize="end"
app:layout_constrainedHeight="true"
android:text="图片描述ihfu描述ihfu描述ih343243243243243432434ihfu描32123415645456456456dsfsadfsdafsdfsadf描述ihfu描述ihfu"
android:textSize="20sp"
app:layout_constraintLeft_toRightOf="@id/imgs"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/imgs" />
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:text="这是一幅风景画幅风景画幅风景画幅景画幅景画幅景画幅"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="@id/imgs"
app:layout_constraintEnd_toEndOf="@+id/textView2"
app:layout_constraintHeight_max="wrap"
app:layout_constraintStart_toStartOf="@+id/textView2" />
-->
android:id="@+id/tv_1"
android:layout_width="50dp"
android:layout_height="30dp"
android:background="#c1c6d1"
android:gravity="center"
android:text="tab1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_2" />
android:id="@+id/tv_2"
android:layout_width="50dp"
android:layout_height="30dp"
android:background="#b2e1d2"
android:gravity="center"
android:text="tab2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@id/tv_1"
app:layout_constraintRight_toLeftOf="@id/tv_3" />
android:id="@+id/tv_3"
android:layout_width="50dp"
android:layout_height="30dp"
android:background="#e5ceeb"
android:gravity="center"
android:text="tab3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@id/tv_2"
app:layout_constraintRight_toRightOf="parent" />
android:layout_width="90dp"
android:layout_height="90dp"
android:background="#99ec8142"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.9"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.9" />
-->
android:id="@+id/cirlce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="根据宽度"
app:layout_constraintCircle="@id/imgs"
app:layout_constraintCircleAngle="180"
app:layout_constraintCircleRadius="100dp" />
android:id="@+id/circle_2"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:text="自动计算屏障位置动计算屏障位"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintTop_toBottomOf="@id/cirlce" />
会在 cirlce circle_2 两个button end(右边) 加一竖线
那么其他的view就可以约束在竖线的right 边显示
不管cirlce circle_2 的宽度怎么变化 竖线也会随之移动
-->
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:constraint_referenced_ids="cirlce,circle_2" />
android:id="@+id/con_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="circle_2,cirlce" />
android:id="@+id/placeHolder"
android:layout_width="match_parent"
android:layout_height="100dp"
app:layout_constraintTop_toBottomOf="@id/circle_2" />
app:layout_constraintTop_toBottomOf="@id/circle_2"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_t2"
android:id="@+id/tv_t1"
app:layout_constrainedWidth="true"
android:text="1AAAAAAAAAAAAAAAAAAAAAAAA"
android:layout_width="wrap_content"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintHorizontal_chainStyle="packed"
android:layout_height="wrap_content" />
app:layout_constraintTop_toBottomOf="@id/circle_2"
android:id="@+id/tv_t2"
app:layout_constraintRight_toRightOf="parent"
android:text="BBBBBBBBBBBBBBBBBBBB0BBBBBBBBB"
app:layout_constraintLeft_toRightOf="@id/tv_t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
、、、
网友评论