gpt4 book ai didi

android - 布局的边框

转载 作者:可可西里 更新时间:2023-11-01 19:08:47 27 4
gpt4 key购买 nike

我正在尝试像这样在我的布局周围制作边框

two text areas with rounded borders

但我正在尝试的只是更改布局颜色。不做任何边框。

我的代码是

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"
>

<stroke android:width="1dp"

android:color="#eedfcc"
android:background="#000080"/>

<corners android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="10dp"
android:topRightRadius="8dp"/>
</shape>

为什么不成功?

最佳答案

试试这个:

第 1 步:在项目的可绘制对象目录 (res/drawable/layout_border.xml) 中创建文件 layout_border.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF"/>
<stroke android:width="3dip" android:color="#B1BCBE" />
<corners android:radius="10dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

第 2 步:

<EditText 
android:id="@+id/edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/layout_border"
/>

关于android - 布局的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11305382/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com