深圳全飞鸿

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 67|回复: 0
打印 上一主题 下一主题

关于ConstraintLayout

[复制链接]

228

主题

466

帖子

2184

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2184
跳转到指定楼层
楼主
发表于 2024-11-30 23:35:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.     xmlns:app="http://schemas.android.com/apk/res-auto"
  4.     xmlns:tools="http://schemas.android.com/tools"
  5.     android:layout_width="match_parent"
  6.     android:layout_height="match_parent"
  7.     tools:context=".MainActivity">

  8.     <TextView
  9.         android:id="@+id/test"
  10.         android:layout_width="wrap_content"
  11.         android:layout_height="wrap_content"
  12.         android:text="@string/test"
  13.         android:textSize="20sp"
  14.         android:padding="10dp"
  15.         android:layout_marginTop="20dp"
  16.         app:layout_constraintLeft_toLeftOf="parent"
  17.         app:layout_constraintRight_toRightOf="parent"
  18.         app:layout_constraintTop_toTopOf="parent" />

  19.     <TextView
  20.         android:id="@+id/k_default"
  21.         android:layout_width="wrap_content"
  22.         android:layout_height="wrap_content"
  23.         android:text="@string/default_language"
  24.         android:textSize="20sp"
  25.         android:padding="10dp"
  26.         android:layout_marginTop="20dp"
  27.         android:textColor="#FFFFFF"
  28.         android:background="@color/colorPrimary"
  29.         app:layout_constraintTop_toBottomOf="@+id/test"
  30.         app:layout_constraintLeft_toLeftOf="parent"
  31.         app:layout_constraintRight_toRightOf="parent"/>
  32.     <TextView
  33.         android:id="@+id/chinese"
  34.         android:layout_width="wrap_content"
  35.         android:layout_height="wrap_content"
  36.         android:text="@string/chinese"
  37.         android:textSize="20sp"
  38.         android:padding="10dp"
  39.         android:layout_marginTop="20dp"
  40.         android:textColor="#FFFFFF"
  41.         android:background="@color/colorPrimary"
  42.         app:layout_constraintTop_toBottomOf="@+id/k_default"
  43.         app:layout_constraintLeft_toLeftOf="parent"
  44.         app:layout_constraintRight_toRightOf="parent"/>

  45.     <TextView
  46.         android:id="@+id/english"
  47.         android:layout_width="wrap_content"
  48.         android:layout_height="wrap_content"
  49.         android:layout_marginTop="44dp"
  50.         android:background="@color/colorPrimary"
  51.         android:padding="10dp"
  52.         android:text="@string/english"
  53.         android:textColor="#FFFFFF"
  54.         android:textSize="20sp"
  55.         app:layout_constraintHorizontal_bias="0.498"
  56.         app:layout_constraintLeft_toLeftOf="parent"
  57.         app:layout_constraintRight_toRightOf="parent"
  58.         app:layout_constraintTop_toBottomOf="@+id/chinese" />
  59. </android.support.constraint.ConstraintLayout>
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|nagomes  

GMT+8, 2025-5-5 03:40 , Processed in 0.027890 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表