Android java 如何使编辑文本透明但文本仍然可见?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7564682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android java how to make a edit text transparent but the text still visible?
提问by Hailei Edwards
How can i make a EditText box invisiable but the text still visiable
如何使 EditText 框不可见但文本仍然可见
<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
是我的代码,但android:visibility="invisible"
让它全部不可见
回答by Rahul Choudhary
Instead of below code
而不是下面的代码
android:visibility="invisible"
use this code
使用此代码
android:background="#00ffffff"
回答by Jakob
android:background="@null"
or
或者
android:background="@android:color/transparent"
回答by ultimate
if you want to make a view semi-transparent then use this code
如果您想让视图半透明,请使用此代码
android:background="#80ffffff"
回答by ankur
try it..
write it on onCreate();
试试吧..写下来 onCreate();
EditText.setBackgroundColor(Color.TRANSPARENT);