首页 > 其他分享 >ConstraintLayout提高-下

ConstraintLayout提高-下

时间:2022-11-21 12:55:52浏览次数:69  
标签:控件 Group 提高 0.2 ConstraintLayout bias app

<iframe frameborder="no" height="240" src="https://catalogue.codepowders.com" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0" width="320"></iframe>

bias的使用

这个不一定在中间可以改变力的大小

    <TextView
        android:layout_width="100dp"
        android:layout_height="50dp"
        android:background="@color/purple_700"
        android:gravity="center"
        android:text="center"
        android:textColor="@color/white"
        android:textSize="24dp"
        app:layout_constraintBottom_toTopOf="@+id/guideline3"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.2"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toTopOf="parent" />

app:layout_constraintHorizontal_bias="0.2"

这个可以改变力的大小,y轴方向同理

Group统一控制控件,比如可不可见

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <TextView
        android:id="@+id/tv1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/passwd"
        android:textSize="23dp"
        android:textColor="@color/black"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/tv2"

        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/passwd"
        android:textColor="@color/black"
        android:textSize="23dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.503"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.609" />

    <TextView
        android:id="@+id/tv3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/passwd"
        android:textColor="@color/black"
        android:textSize="23dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.409" />

    <androidx.constraintlayout.widget.Group
    android:layout_width="wrap_content"
        app:constraint_referenced_ids="tv1,tv2,tv3"
        android:visibility="visible"
    android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>

  GitHub地址 下载前给star

标签:控件,Group,提高,0.2,ConstraintLayout,bias,app
From: https://www.cnblogs.com/Frank-dev-blog/p/16911093.html

相关文章