java - 透明EditText Android Studio

标签 java android xml android-studio android-layout

我正在尝试使我的 android studio 项目中的 EditText 透明。我希望它看起来像这里的 EditText

但我的看起来并不像那样,即使我尝试使用 transparentffffff 有人可以帮我解决这个问题吗?我希望我的编辑文本背景看起来像我所显示的图像中的背景。

最佳答案

<EditText
        android:layout_width="match_parent"
        android:layout_margin="32dp"
        android:layout_height="wrap_content"
        android:hint="Username"
        android:padding="16dp"
        android:background="@drawable/edittext_bg" />

drawables 文件夹中的 edittext_bg.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#80ffffff" />
    <corners android:radius="5dp" />
</shape>

更改 <solid android:color="#80ffffff" /> 的颜色值调整透明度。

关于java - 透明EditText Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56941056/

相关文章:

java - 如何使用 J-unit 测试简单的 if else 语句?

java - Android 中的 HTML 解析

android - "Speed limits are not available for this project"实现 Google Speed Limit Api 时出现问题

java - 使用 saxon 获取远程 XML

xml - 防止第三方操纵 XML 文件

c# - 将复杂的 XML 反序列化为 C# 对象

c# - 在回调时反序列化 soap 消息时出现问题

java - 在Java中,在抛出异常的方法中关闭变量的正确方法是什么?

android - 无法使用 React Native 和 Firebase 进行 Google OAuth 身份验证

java - 为什么我会收到 NullPointerException?