Android常用布局使用技巧示例讲解

  <?xml version="1.0" encoding="utf-8"?>

  

  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">

  

  android:id="@+id/c_view1"

  android:layout_height="wrap_content"

  android:layout_width="match_parent"

  app:layout_constraintStart_toStartOf="parent"

  app:layout_constraintTop_toTopOf="parent"

  android:layout_gravity="fill"

  android:gravity="end"

  android:layout_marginStart="5dp"

  android:layout_marginEnd="5dp"

  android:layout_marginTop="5dp"

  android:background="#FFCCCC"

  android:text="0"

  android:textSize="50sp" />

  

  android:layout_height="wrap_content"

  android:layout_width="0dp"

  app:layout_constraintTop_toBottomOf="@id/c_view1"

  app:layout_constraintStart_toStartOf="@id/c_view1"

  app:layout_constraintEnd_toStartOf="@id/btn_qk"

  android:layout_marginEnd="5dp"

  android:textSize="40sp"

  android:id="@+id/btn_ht"

  android:text="回退" />

  

  android:id="@+id/btn_qk"

  android:layout_height="0dp"

  android:layout_width="0dp"

  app:layout_constraintEnd_toEndOf="@id/c_view1"

  app:layout_constraintStart_toEndOf="@id/btn_ht"

  app:layout_constraintTop_toBottomOf="@id/c_view1"

  app:layout_constraintBottom_toBottomOf="@id/btn_ht"

  android:textSize="40sp"

  android:text="清空" />