已选中 倾斜切负距离;(实际 是 通过 左右距离 固定宽度 实现的)
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:simple="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="100dp" android:layout_margin="@dimen/dp_10" android:background="@color/transparent"> <android.support.constraint.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/shape_coupon_up" android:orientation="horizontal" simple:layout_constraintBottom_toBottomOf="parent" simple:layout_constraintEnd_toEndOf="parent" simple:layout_constraintStart_toStartOf="parent" simple:layout_constraintTop_toTopOf="parent"> <android.support.constraint.ConstraintLayout android:id="@+id/left" android:layout_width="0dp" android:layout_height="match_parent" android:background="@drawable/shape_coupon_left" simple:layout_constraintEnd_toStartOf="@+id/right" simple:layout_constraintHorizontal_weight="2" simple:layout_constraintStart_toStartOf="parent" simple:layout_constraintTop_toTopOf="parent"> <TextView android:id="@+id/tv_coupon_type" android:layout_width="80dp" android:layout_height="25dp" android:background="@drawable/shape_coupon_type" android:gravity="center" android:text="现金券" android:textColor="@color/white" android:textSize="@dimen/sp_12" simple:layout_constraintStart_toStartOf="parent" simple:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/tv_content" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="6dp" android:ellipsize="end" android:maxLines="1" android:text="任意订单减0.5元" android:textColor="@color/gray_order" simple:layout_constraintEnd_toEndOf="parent" simple:layout_constraintStart_toStartOf="parent" simple:layout_constraintTop_toBottomOf="@+id/tv_coupon_type" /> <TextView android:id="@+id/tv_rules" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="6dp" android:text="通用打印:文档、图片、照片、身份证" android:textColor="@color/gray_order" android:textSize="@dimen/font_10" simple:layout_constraintStart_toStartOf="parent" simple:layout_constraintTop_toBottomOf="@+id/tv_content" /> <TextView android:id="@+id/tv_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="4dp" android:text="有效期:2019-10-11至2019-11-11" android:textColor="@color/gray_order" android:textSize="@dimen/font_10" simple:layout_constraintStart_toStartOf="parent" simple:layout_constraintTop_toBottomOf="@+id/tv_rules" /> </android.support.constraint.ConstraintLayout> <android.support.constraint.ConstraintLayout android:id="@+id/right" android:layout_width="0dp" android:layout_height="match_parent" android:background="@drawable/shape_coupon_right" simple:layout_constraintEnd_toEndOf="parent" simple:layout_constraintHorizontal_weight="1" simple:layout_constraintStart_toEndOf="@+id/left" simple:layout_constraintTop_toTopOf="parent"> <TextView android:id="@+id/tv_money" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:text="0.5" android:textColor="@color/white" android:textSize="@dimen/font_30" simple:layout_constraintEnd_toEndOf="parent" simple:layout_constraintStart_toStartOf="parent" simple:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/tv_money_symbol" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/money_simple" android:textColor="@color/white" simple:layout_constraintBaseline_toBaselineOf="@+id/tv_money" simple:layout_constraintStart_toEndOf="@+id/tv_money" /> <TextView android:id="@+id/tv_platform" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginTop="4dp" android:layout_marginEnd="10dp" android:ellipsize="end" android:maxLines="2" android:text="所有校区/所有平台通用" android:textColor="@color/white" android:textSize="@dimen/font_10" simple:layout_constraintEnd_toEndOf="parent" simple:layout_constraintStart_toStartOf="parent" simple:layout_constraintTop_toBottomOf="@+id/tv_money" /> <TextView android:id="@+id/tv_select" android:layout_width="70dp" android:layout_height="20dp" android:layout_marginStart="50dp" android:layout_marginTop="8dp" android:background="@color/white" android:gravity="center" android:rotation="45" android:text="已选中" android:textColor="@color/app_yellow" android:textSize="@dimen/font_11" android:visibility="visible" simple:layout_constraintEnd_toEndOf="parent" simple:layout_constraintStart_toStartOf="@+id/tv_money" simple:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>