android 设置EditText和TextView不可见
16lz
2021-01-25
这个很简单,
--------------------- 设置TextView为不可见 ------------------------
设置TextView为不可见,只需
tv.setText(""); //清空文字
或者 tv.setTextColor(0x00000000); //设置文字颜色为透明
并且 不设置背景颜色,或者
tv.setBackgroundColor(0x00ffffff);//把背景颜色设置为透明
再设置TextView为可见的方法是
tv.setText("******"); //填充文字
或者 tv.setTextColor(0xFF000000); //设置文字颜色为不透明
---------------------------------------------------------------
--------------------- 设置EditText为不可见 -----------------------
et.setTextColor(0x00000000); //设置文字颜色为透明
并且 不设置背景颜色,或者
et.setBackgroundColor(0x00ffffff);//把背景颜色设置为透明
再设置EditText为可见的方法是
et.setTextColor(0xFF000000); //设置文字颜色为不透明
---------------------------------------------------------------
--------------------- 设置TextView为不可见 ------------------------
设置TextView为不可见,只需
tv.setText(""); //清空文字
或者 tv.setTextColor(0x00000000); //设置文字颜色为透明
并且 不设置背景颜色,或者
tv.setBackgroundColor(0x00ffffff);//把背景颜色设置为透明
再设置TextView为可见的方法是
tv.setText("******"); //填充文字
或者 tv.setTextColor(0xFF000000); //设置文字颜色为不透明
---------------------------------------------------------------
--------------------- 设置EditText为不可见 -----------------------
et.setTextColor(0x00000000); //设置文字颜色为透明
并且 不设置背景颜色,或者
et.setBackgroundColor(0x00ffffff);//把背景颜色设置为透明
再设置EditText为可见的方法是
et.setTextColor(0xFF000000); //设置文字颜色为不透明
---------------------------------------------------------------
更多相关文章
- Android(安卓)自定义手写签名并保存到sdcard中(可以保存背景图)
- android selector 无效的问题
- Android(安卓)log详解
- android Java代码设置textview的字体资源颜色
- android window 一些属性说明
- android:theme 常用颜色colorPrimary,colorPrimaryDark等属性使
- android自定义TextView(一)
- linear gradient 的问题
- Android(安卓)Quick Tips #2 — Android(安卓)Studio Productivi