ConstraintLayout的详细使用

 

<?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"
    android:id="@+id/relativeLayout4"
    android:layout_width="@dimen/xa300"
    android:layout_height="@dimen/xa240"
    android:layout_marginLeft="@dimen/xa10"
    android:background="@drawable/shape_gray_stroke">

    <ImageView
        android:id="@+id/ivCheck"
        android:layout_width="@dimen/xa70"
        android:layout_height="@dimen/xa40"
        android:layout_marginEnd="@dimen/xa10"
        android:layout_marginRight="@dimen/xa10"
        android:layout_marginTop="@dimen/xa10"
        android:src="@drawable/smarthome_on"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <com.growatt.shinephone.view.AutoFitTextView
        android:id="@+id/tv_name"
        android:layout_width="0dp"
        android:layout_height="@dimen/xa30"
        android:layout_marginEnd="@dimen/xa58"
        android:layout_marginLeft="@dimen/xa10"
        android:layout_marginRight="@dimen/xa58"
        android:layout_marginStart="@dimen/xa10"
        android:background="@drawable/btn_circle_gray"
        android:gravity="center"
        android:padding="@dimen/xa3"
        android:text="@string/m车库充电桩"
        app:layout_constraintBottom_toBottomOf="@+id/ivCheck"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="@+id/ivCheck"
        app:layout_constraintTop_toTopOf="@+id/ivCheck" />

    <android.support.constraint.Guideline
        android:id="@+id/gl_vtl_95"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_begin="@dimen/xa95" />


    <com.growatt.shinephone.view.AutoFitTextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/xa13"
        android:padding="@dimen/xa3"
        android:text="充电中"
        android:textColor="@color/headerView"
        android:textSize="@dimen/xa24"
        app:layout_constraintLeft_toLeftOf="@+id/tv_name"
        app:layout_constraintRight_toLeftOf="@+id/gl_vtl_95"
        app:layout_constraintTop_toBottomOf="@+id/tv_name" />

    <ImageView
        android:id="@+id/iv_charger_status"
        android:layout_width="@dimen/xa80"
        android:layout_height="@dimen/xa80"
        android:src="@drawable/charger_status_on"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.45" />

    <TextView
        android:id="@+id/tv_AC_DC"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="@dimen/xa4"
        android:layout_marginTop="@dimen/xa8"
        android:gravity="center"
        android:text="交流"
        android:textColor="@color/title_3"
        android:textSize="@dimen/xa24"
        app:layout_constraintRight_toLeftOf="@+id/tv_divider"
        app:layout_constraintTop_toBottomOf="@+id/iv_charger_status" />

    <TextView
        android:id="@+id/tv_divider"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/xa8"
        android:gravity="center"
        android:text="|"
        android:textColor="@color/title_3"
        android:textSize="@dimen/xa24"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/iv_charger_status" />

    <TextView
        android:id="@+id/tv_Gun"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/xa4"
        android:layout_marginTop="@dimen/xa8"
        android:gravity="center"
        android:text="双枪"
        android:textColor="@color/title_3"
        android:textSize="@dimen/xa24"
        app:layout_constraintLeft_toRightOf="@+id/tv_divider"
        app:layout_constraintTop_toBottomOf="@+id/iv_charger_status" />

    <RelativeLayout
        android:id="@+id/rl_switch_gun"
        android:layout_width="@dimen/xa120"
        android:layout_height="@dimen/xa42"
        android:background="@drawable/btn_baground_blue"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/tv_Gun">

        <TextView
            android:id="@+id/tvSwitchGun"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:minWidth="@dimen/xa150"
            android:text="A枪"
            android:textColor="@color/headerView"
            android:textSize="@dimen/xa30" />

        <ImageView
            android:layout_width="@dimen/xa18"
            android:layout_height="match_parent"
            android:layout_alignParentRight="true"
            android:layout_marginRight="@dimen/xa18"
            android:src="@drawable/gun_drop" />
    </RelativeLayout>


</android.support.constraint.ConstraintLayout>

http://www.qingpingshan.com/m/view.php?aid=362115

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值