android - 如何在 Android Studio Kotlin 中放大约束布局周围的边框
问题描述
如图所示,我正在约束布局周围设置边框(浅绿色边框)。如何放大边框,如“RED”(附图)所示我尝试了填充命令,但没有做出任何改变。有人可以建议一个解决方案。谢谢!
<TextView
android:id="@+id/viewBorder"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/outside_shape"
app:layout_constraintBottom_toBottomOf="@id/favoriteButton"
app:layout_constraintEnd_toEndOf="@+id/favoriteButton"
app:layout_constraintStart_toStartOf="@id/eventImage"
app:layout_constraintTop_toTopOf="@id/eventPerson" />
这是背景形状的代码
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:width="1dp"
android:color="#04C187" />
<padding android:left="6dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"/>
</shape>
解决方案
您的边框基本上来自背景形状,只需更改背景形状描边的宽度
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:width="5dp" <!-- Change the Width Here -->
android:color="#04C187" />
<padding android:left="6dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"/>
</shape>
推荐阅读
- flutter - Flutter Speech Recognition:如何获取单词正确发音与用户发音之间“相似度”的百分比
- material-ui - MUIv5 自动完成:如何在不重复名称的情况下定位子类?
- python-3.x - 无法在终端上执行 python3(PYTHONPATH 和 PATH 并发症)
- c# - 为什么一个文件中的一个 c# 类没有找到另一个文件/文件夹中定义的另一个类?
- mysql - MYSQL读取通讯包报错
- php - 如何发送变量?
- aws-lambda - AWS 事件桥 Lambda 调用
- sas - 每个月的 Proc sql 总和
- ssl - 我的 SSL 证书是否足以在我的购物车上进行金融交易
- php - 我可以通过 Id 获取特定的 JSON 值吗?