当前位置: 首页 > news >正文

Android约束布局ConstraintLayout的Guideline,CardView

Android约束布局ConstraintLayout的Guideline,CardView

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="match_parent"android:layout_height="match_parent"><androidx.constraintlayout.widget.Guidelineandroid:id="@+id/guide_line"android:layout_width="wrap_content"android:layout_height="wrap_content"android:orientation="vertical"app:layout_constraintGuide_percent="0.67" /><androidx.cardview.widget.CardViewandroid:id="@+id/card"android:layout_width="0dp"android:layout_height="0dp"app:cardBackgroundColor="@android:color/holo_orange_light"app:cardCornerRadius="20dp"app:layout_constraintDimensionRatio="1:1"app:layout_constraintEnd_toEndOf="@id/guide_line"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"><androidx.appcompat.widget.AppCompatImageViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:scaleType="centerCrop"android:src="@drawable/ic_launcher_foreground" /></androidx.cardview.widget.CardView><androidx.cardview.widget.CardViewandroid:id="@+id/v1"android:layout_width="0dp"android:layout_height="0dp"app:cardBackgroundColor="@android:color/holo_green_light"app:cardCornerRadius="20dp"app:layout_constraintBottom_toTopOf="@id/v2"app:layout_constraintDimensionRatio="1:1"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="@id/guide_line"><ImageViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:scaleType="centerCrop"android:src="@drawable/ic_launcher_foreground" /></androidx.cardview.widget.CardView><androidx.cardview.widget.CardViewandroid:id="@+id/v2"android:layout_width="0dp"android:layout_height="0dp"app:cardBackgroundColor="@android:color/holo_red_light"app:cardCornerRadius="20dp"app:layout_constraintDimensionRatio="1:1"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="@id/guide_line"app:layout_constraintTop_toBottomOf="@id/v1"><ImageViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:scaleType="centerCrop"android:src="@drawable/ic_launcher_foreground" /></androidx.cardview.widget.CardView>
</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

http://www.lryc.cn/news/186982.html

相关文章:

  • LVGL8.3.6 Flex(弹性布局)
  • 计算机算法分析与设计(8)---图像压缩动态规划算法(含C++)代码
  • React 状态管理 - Mobx 入门(上)
  • OLED透明屏技术在智能手机、汽车和广告领域的市场前景
  • 考研是为了逃避找工作的压力吗?
  • 广州华锐互动:VR动物解剖实验室带来哪些便利?
  • Uniapp 婚庆服务全套模板前端
  • RabbitMQ-网页使用消息队列
  • 弹性资源组件elastic-resource设计(四)-任务管理器和资源消费者规范
  • 【Java】微服务——RabbitMQ消息队列(SpringAMQP实现五种消息模型)
  • react高阶成分(HOC)实践例子
  • 20231005使用ffmpeg旋转MP4视频
  • MySQL-锁
  • ES6中变量解构赋值
  • Dijkstra 邻接表表示算法 | 贪心算法实现--附C++/JAVA实现源码
  • 从城市吉祥物进化到虚拟人IP需要哪些步骤?
  • 认识SQLServer
  • Python开发IDE的比较:PyCharm vs. VS Code vs. Jupyter
  • 1206. 设计跳表
  • 【API要返回一棵树的结构】数据库表结构是平铺的数据,但是api要实现树状结构展示。api实现一棵树的结构,如何实现呢,递归?如何递归呢
  • 视频批量剪辑工具,自定义视频速率,批量剪辑工具助力创意无限”
  • starrocks启动和停止和重启脚本
  • 升级Xcode 15后,出现大量Duplicate symbols问题
  • Godot2D角色导航教程(角色随鼠标移动)
  • 论文阅读--Cell-free massive MIMO versus small cells
  • 【深度学习】UniControl 一个统一的扩散模型用于可控的野外视觉生成
  • 使用ChatGPT和MindShow一分钟生成PPT模板
  • C#对字典容器Dictionary<TKey, TValue>内容进行XML序列化或反序列化报错解决方法
  • 【Linux】Linux 之用户管理
  • NLP:Attention和self-attention的区别