简体   繁体   中英

Android java how to make a edit text transparent but the text still visible?

How can i make a EditText box invisiable but the text still visiable

<EditText android:layout_height="wrap_content" android:visibility="invisible" android:text="TestttttttttttttttttTTTTTTTTTTTTTTTTTTTTTTTT" android:layout_width="wrap_content" android:id="@+id/editText1" android:layout_above="@+id/trait1" android:layout_alignParentLeft="true" android:layout_marginBottom="78dp">
        <requestFocus></requestFocus>
    </EditText>

is my code but android:visibility="invisible" makes it all invisible

Instead of below code

android:visibility="invisible"

use this code

android:background="#00ffffff"
android:background="@null"

要么

android:background="@android:color/transparent"

如果您想使视图半透明,请使用此代码

android:background="#80ffffff"

试试吧..把它写在onCreate();

EditText.setBackgroundColor(Color.TRANSPARENT);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM