我需要展示一个EditText,使用经典布局显示完整的文本框,而不仅仅是底部的线。在布局编辑器中,我可以看到它是这样的,但是当运行应用程序时,它只显示底部的线条。我正在使用
这是我想要的:
这是我看到的:
android:Theme.Light
的应用程序主题。我该如何更改呢?这是我想要的:
![enter image description here](https://istack.dev59.com/oxLaK.webp)
![enter image description here](https://istack.dev59.com/uNzLg.webp)
android:Theme.Light
的应用程序主题。我该如何更改呢?//你可以尝试这个,它对我有效
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#00000000" />
<stroke android:width="2.5dp"
android:color="#FFFFFF" />
<corners
android:radius="5dp"/>
</shape>
Then use this shape for the edit text widget inside an activity xml file as required:
<EditText
android:id="@+id/searchBox"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:background="@drawable/textinputborder"
android:hint="@string/Search"
android:paddingLeft="10dp"
android:inputType="textVisiblePassword" >
</EditText>
尝试使用这个解决方案
<stroke
android:width="2dp"
android:color="#E7E7E7"
android:height="10dp"/>
<corners
android:radius="5dp"/>
你可以将一个图像框作为可绘制对象导入,然后像这样将其设置为背景。
<EditText
android:id="@+id/textinput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/imagebox"/>
这样做后,图像框将放置在文本框下方,下划线也会消失。