码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Android约束布局ConstraintLayout的Guideline,CardView


    Android约束布局ConstraintLayout的Guideline,CardView

    1. "1.0" encoding="utf-8"?>
    2. <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    3. xmlns:app="http://schemas.android.com/apk/res-auto"
    4. android:layout_width="match_parent"
    5. android:layout_height="match_parent">
    6. <androidx.constraintlayout.widget.Guideline
    7. android:id="@+id/guide_line"
    8. android:layout_width="wrap_content"
    9. android:layout_height="wrap_content"
    10. android:orientation="vertical"
    11. app:layout_constraintGuide_percent="0.67" />
    12. <androidx.cardview.widget.CardView
    13. android:id="@+id/card"
    14. android:layout_width="0dp"
    15. android:layout_height="0dp"
    16. app:cardBackgroundColor="@android:color/holo_orange_light"
    17. app:cardCornerRadius="20dp"
    18. app:layout_constraintDimensionRatio="1:1"
    19. app:layout_constraintEnd_toEndOf="@id/guide_line"
    20. app:layout_constraintStart_toStartOf="parent"
    21. app:layout_constraintTop_toTopOf="parent">
    22. <androidx.appcompat.widget.AppCompatImageView
    23. android:layout_width="match_parent"
    24. android:layout_height="match_parent"
    25. android:scaleType="centerCrop"
    26. android:src="@drawable/ic_launcher_foreground" />
    27. androidx.cardview.widget.CardView>
    28. <androidx.cardview.widget.CardView
    29. android:id="@+id/v1"
    30. android:layout_width="0dp"
    31. android:layout_height="0dp"
    32. app:cardBackgroundColor="@android:color/holo_green_light"
    33. app:cardCornerRadius="20dp"
    34. app:layout_constraintBottom_toTopOf="@id/v2"
    35. app:layout_constraintDimensionRatio="1:1"
    36. app:layout_constraintEnd_toEndOf="parent"
    37. app:layout_constraintStart_toStartOf="@id/guide_line">
    38. <ImageView
    39. android:layout_width="match_parent"
    40. android:layout_height="match_parent"
    41. android:scaleType="centerCrop"
    42. android:src="@drawable/ic_launcher_foreground" />
    43. androidx.cardview.widget.CardView>
    44. <androidx.cardview.widget.CardView
    45. android:id="@+id/v2"
    46. android:layout_width="0dp"
    47. android:layout_height="0dp"
    48. app:cardBackgroundColor="@android:color/holo_red_light"
    49. app:cardCornerRadius="20dp"
    50. app:layout_constraintDimensionRatio="1:1"
    51. app:layout_constraintEnd_toEndOf="parent"
    52. app:layout_constraintStart_toStartOf="@id/guide_line"
    53. app:layout_constraintTop_toBottomOf="@id/v1">
    54. <ImageView
    55. android:layout_width="match_parent"
    56. android:layout_height="match_parent"
    57. android:scaleType="centerCrop"
    58. android:src="@drawable/ic_launcher_foreground" />
    59. androidx.cardview.widget.CardView>
    60. androidx.constraintlayout.widget.ConstraintLayout>

    约束布局里面,用到match_parent的地方,可以考虑换成0dp试试。

    Android ConstraintLayout layout_constraintHorizontal layout_constraintDimensionRatio square CardView-CSDN博客Android ConstraintLayout按比例缩放View关键点有两个,第一,使用Android ConstraintLayout的layout_constraintDimensionRatio属性,设置宽高比缩放比例,宽:高。Android ConstraintLayout约束布局的居中_android constraintlayout 两个图片并排水平居中-CSDN博客。Android ConstraintLayout按比例缩放View_constraintlayout 比例-CSDN博客。https://zhangphil.blog.csdn.net/article/details/133324821

    Android ConstraintLayout app:layout_constraintHorizontal_weight-CSDN博客Android ConstraintLayout按比例缩放View关键点有两个,第一,使用Android ConstraintLayout的layout_constraintDimensionRatio属性,设置宽高比缩放比例,宽:高。Android ConstraintLayout约束布局的居中_android constraintlayout 两个图片并排水平居中-CSDN博客。Android ConstraintLayout按比例缩放View_constraintlayout 比例-CSDN博客。https://blog.csdn.net/zhangphil/article/details/133323625

  • 相关阅读:
    Java如何对接阿里云盘API
    【Spring Cloud】初识RabbitMQ
    RabbitMQ【直连、主题、扇形交换机实战】
    Spark的部署与使用
    蓝桥等考Python组别十四级005
    计算机的基本组成是什么样子的?
    【java】 对命名规范的思考——VO,BO,PO,DO,DTO是什么
    【手把手】教你玩转SpringCloud Alibaba之Nacos Config深入
    【探索C++】C++对C语言的扩展
    UOS统信操作系统QIcon::fromTheme详解
  • 原文地址:https://blog.csdn.net/zhangphil/article/details/133350654
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号