gpt4 book ai didi

Android 选择器显示错误

转载 作者:行者123 更新时间:2023-11-29 14:37:21 26 4
gpt4 key购买 nike

在我的 android xml 文件中,我有一个 edittext。我试图自定义 edittext,xml 看起来像:--

 <EditText
android:id="@+id/edi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginTop="10dp"
android:layout_gravity="center"
android:hint="Username"
android:background="@layout/textbox001"
android:drawableLeft="@drawable/usernameicon"
/ >

在布局中,textbox001 是:--

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

<item android:state_pressed="true" >
<shape>
<gradient
android:startColor="#e4e4e2"
android:endColor="#d5d5d5"
android:angle="270" />
<stroke
android:width="0dp"
android:color="#282a2f" />
<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:endColor="#e4e4e2"
android:startColor="#d5d5d5"
android:angle="270"
/>
<stroke
android:width="0dp"
android:color="#282a2f" />
<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />

</shape>
</item>
</selector>

但它在选择器中显示错误..即:--

element selector does not have  required attribute android:layout_width 
element selector does not have required attribute android:layout_height

问题出在哪里???我该如何解决??在 xml 图形中,它还显示:--

The graphics preview in the layout editor may not be accurate:
Different corner sizes are not supported in Path.addRoundRect. (Ignore for this session)

最佳答案

我认为您应该将选择器文件放在可绘制文件夹中,而不是布局文件夹中!

关于Android 选择器显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28941561/

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