技术经验谈 技术经验谈
首页
  • 最佳实践

    • 抓包
    • 数据库操作
  • ui

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • 总纲
  • 整体开发框架
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

hss01248

一号线程序员
首页
  • 最佳实践

    • 抓包
    • 数据库操作
  • ui

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • 总纲
  • 整体开发框架
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 最佳实践

  • ui

    • android的activity布局玩法
    • ConstraintLayout玩法
      • EditText的setOnFocusListener无缝转变成addOnFocusListener
      • webview被导航栏遮盖的处理
      • 输入框的下拉联想list
    • 优化

    • aop

    • apm

    • 架构

    • webview

    • rxjava

    • activity-fragment-view的回调和日志
    • Android加密相关
    • Android命令行操作
    • app后台任务
    • kotlin
    • kotlin漫谈
    • kotlin语言导论
    • sentry上传mapping.txt文件
    • so放于远程动态加载方案
    • states
    • Xposed模块开发
    • 一个关于manifest合并的猥琐操作
    • 玩坏android存储
    • 获取本app的安装来源信息
    • Android
    • ui
    hss01248
    2022-07-05
    目录

    ConstraintLayout玩法

    # ConstraintLayout玩法

    # 1 同一行,左右排列,互怼,某一边必须一行,某一边自动换行

    image-20220705193905549

    实现方式:

    1 首尾互相约束成链(chain)

    2 链头部item声明chain的空间排布方式: app:layout_constraintHorizontal_chainStyle="spread_inside"

    3 自动换行的item : android:layout_width="0dp" + app:layout_constraintHorizontal_weight="1"

    <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_marginTop="16dp"
            android:layout_height="wrap_content">  
    		<TextView
            android:text="@string/xxxxxxxxxxxxxxx"
            android:textSize="14dp"
            android:textColor="#666666"
            android:fontFamily="@font/roboto_medium"
            android:id="@+id/tv_pay_await_status"
            app:layout_constraintTop_toBottomOf="@id/tv_pay_success_time"
            app:layout_constraintLeft_toLeftOf="parent"
            android:layout_marginLeft="28dp"
            app:layout_constraintRight_toLeftOf="@id/tv_pay_await_amount"
            android:layout_marginTop="16dp"
            android:layout_width="0dp"
            app:layout_constraintHorizontal_chainStyle="spread_inside"
            app:layout_constraintHorizontal_weight="1"
            android:layout_marginBottom="2dp"
            android:layout_height="wrap_content"/>
        <TextView
            tools:text="Rp10000000000000000000000000000"
            android:layout_marginLeft="12dp"
            android:textSize="14dp"
            android:textColor="#F0463C"
            android:fontFamily="@font/roboto_bold"
            android:id="@+id/tv_pay_await_amount"
            app:layout_constraintTop_toTopOf="@id/tv_pay_await_status"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintLeft_toRightOf="@id/tv_pay_await_status"
            android:layout_width="wrap_content"
            android:layout_marginBottom="2dp"
            android:layout_height="wrap_content"/>
    
    </androidx.constraintlayout.widget.ConstraintLayout>
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35

    # 参考

    万字长文 - 史上最全ConstraintLayout(约束布局)使用详解 (opens new window)

    ConstraintLayout 实现LinearLayout weight效果 (opens new window)

    编辑 (opens new window)
    上次更新: 2022/08/25, 20:20:31
    android的activity布局玩法
    EditText的setOnFocusListener无缝转变成addOnFocusListener

    ← android的activity布局玩法 EditText的setOnFocusListener无缝转变成addOnFocusListener→

    最近更新
    01
    截图后的自动压缩工具
    12-27
    02
    图片视频文件根据exif批量重命名
    12-27
    03
    chatgpt图片识别描述功能
    02-20
    更多文章>
    Theme by Vdoing | Copyright © 2020-2025 | 粤ICP备20041795号
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式